Column names specified by @JoinColumn(name="testColumnId") lowercased
----------------------------------------------------------------------
Key: HHH-7248
URL:
https://hibernate.onjira.com/browse/HHH-7248
Project: Hibernate ORM
Issue Type: Bug
Components: annotations
Affects Versions: 4.1.2, 3.6.8
Reporter: timoffei
Even though i use ejb3namingstrategy, at runtime, column names specified by
@javax.persistence.JoinColumn(name="testColumnId")
are lowercased as "testcolumnid".
In hibernate 3.6.4 it runs successfully generating sql code as:
select top 25 testem0_.testColumnId as testZ9_62_, testem0_.testColumn2Id as testT14_62_
from Testems testem0_
whereas 3.6.7 generates code as:
WITH query AS (select ROW_NUMBER() OVER (order by testem0_.id asc) as
__hibernate_row_nr__, testem0_.testcolumnid as test9_62_, testem0_.testcolumn2id as
testT14_62_ from Testems testem0_ ) SELECT * FROM query WHERE __hibernate_row_nr__ BETWEEN
? AND ?
Which fails:
WARN 04.14 04:34:03 org.hibernate.util.JDBCExceptionReporter - SQL Error: 207, SQLState:
42S22
ERROR 04.14 04:34:03 org.hibernate.util.JDBCExceptionReporter - Invalid column name
'testcolumnid'.
WARN 04.14 04:34:03 org.hibernate.util.JDBCExceptionReporter - SQL Error: 207, SQLState:
42S22
ERROR 04.14 04:34:03 org.hibernate.util.JDBCExceptionReporter - Invalid column name
'testcolumn2id'.
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2536)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.loader.Loader.list(Loader.java:2271)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
Caused by: java.sql.SQLException: Invalid column name 'testcolumnid'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
~[jtds-1.2.2.jar:1.2.2]
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)
~[jtds-1.2.2.jar:1.2.2]
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)
~[jtds-1.2.2.jar:1.2.2]
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631)
~[jtds-1.2.2.jar:1.2.2]
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
~[jtds-1.2.2.jar:1.2.2]
at
net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:777)
~[jtds-1.2.2.jar:1.2.2]
at
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
~[c3p0-0.9.1.jar:0.9.1]
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:802)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2533)
~[hibernate-core-3.6.7.Final.jar:3.6.7.Final]
... 89 common frames omitted
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira