[hibernate-dev] Table and quoted names

Dmitry Geraskov dgeraskov at exadel.com
Thu Sep 30 08:09:45 EDT 2010


  Hi, guys,
while I was fixing some bug in hibernate tools I looked through some 
hibernate code.
And it seems to me that hibernate is not ready in some cases for quoted 
identifiers.

Here I would like to highlight some potentially weak places in key class 
org.hibernate.mapping.Table.
It doesn't ready for quoted catalog identifiers.
There are (catalog, schema, name) fields and (schemaQuoted,quoted). 
There is no "catalogQuoted", but probably it should be.
The static method qualify() in most cases used to generate unique key 
and cache some data. It is used in such way:

String key = Table.qualify(catalog, schema, name);
and it is a potentially(non-unique) problem if there are names with dots.
"catalog.my.schema.table" = "catalog.my"."schema"."table" or 
"catalog"."my.schema"."table".

I didn't find any usage of Table#isSchemaQuoted(), and 
DatabaseMetadata#getTableMetadata(..., isQuoted) called with 
Table#isQuoted() parameter. Perhaps there should be
isQuoted = Table#isQuoted() || Table#isSchemaQuoted() || 
Table#isCatalogQuoted() ?

Dmitry Geraskov.



More information about the hibernate-dev mailing list