[hibernate-dev] DatabaseMetaData question

Steve Ebersole steve at hibernate.org
Sat Jul 28 01:10:19 EDT 2012


Here is what I ended up doing, if anyone in the know could take a look:
https://github.com/hibernate/hibernate-orm/blob/metamodel/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/NormalizingIdentifierHelperImpl.java

The biggest issue is when you have a quoted name that just happens to 
be all upper or all lower case.  No idea how to determine that.  For 
example, if you have a quoted table named MY_TABLE coming out from of 
the databasemetadata methods and 
storesMixedCaseQuotedIdentifiers/storesUpperCaseIdentifiers  (the 
normal case) I am not sure how you can determine that name is actually 
quoted.


On Fri 27 Jul 2012 07:32:52 PM CDT, Steve Ebersole wrote:
> Anyone know if there is a (standard JDBC) way to know if the names
> returned in the various result sets from DatabaseMetaData are quoted
> names?
>
> For example, DatabaseMetaData.getTables(...) returns a ResultSet that
> includes, amongst other stuff, catalog name, schema name and table
> name.  But I need to know if those names are quoted.
>
> Do I just have to leverage the DatabaseMetaData values like:
> storesMixedCaseQuotedIdentifiers
> storesLowerCaseQuotedIdentifiers
> storesUpperCaseQuotedIdentifiers
> storesUpperCaseIdentifiers
> storesLowerCaseIdentifiers
>
> and use them to decipher the incoming text based on case?  Is that
> really the only/best option?  Or am I missing something?
>
>

--
steve at hibernate.org
http://hibernate.org


More information about the hibernate-dev mailing list