|
|
|
Proper keyword quoting depends on being able to recognize identifiers as matching a keyword, which in turn relies on having a complete definition of what identifiers are keywords. The baseline for the set of keywords are those defined by ANSI SQL. {{jav.sql.DatabaseMetaData#getSQLKeywords}} is meant to augment the ANSI SQL (2003) standard keywords. We also have {{Dialect#getKeywords}} which in turn should augment that combined set. But at them moment we do not maintain that baseline set.
----
Original description
{quote} Hibernate gets the "extra" keywords from java froma jav .sql.DatabaseMetaData.getSQLKeywords(), but that doesn't get the ANSI 2003 keywords. It does not seem to track the ANSI SQL keywords unless explicitly specified by the dialect.
There's a comment in JdbcEnvironmentImpl: // todo : should really maintain a standard list of know ANSI-SQL defined keywords somewhere (currently rely on Dialect) private final Set<String> reservedWords = new HashSet<String>();
Should these keywords be added directly to Dialect, or should they be dialect-specific?
This can be reproduced using SQLServer2012Dialect: * org.hibernate.test.collection.original.CollectionTest fails if the table mapping for "User" entity is removed from hibernate-core/src/test/java/org/hibernate/test/collection/original/UserPermissions.hbm.xml (USER is an ANSI SQL reserved word); * ASTParserLoadingTest.testJPAQLQualifiedIdentificationVariablesControl() fails if the column mapping for VariousKeywordPropertyEntity.key is removed from hibernate-core/src/test/java/org/hibernate/test/hql/VariousKeywordPropertyEntity.hbm.xml * {quote}
|
|
|
|