HQL Query containing joins does not work
----------------------------------------
Key: HHH-5117
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5117
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Final
Environment: Eclipse
java.vendor=Sun Microsystems Inc.,
env.SESSION_MANAGER=local/tb-it-scape:@/tmp/.ICE-unix/2248,unix/tb-it-scape:/tmp/.ICE-unix/2248,
localRepository=/home/thierry/.m2/repository, sun.java.launcher=SUN_STANDARD,
hibernate.connection.url=jdbc:mysql://localhost:3306/IT_Scape,
sun.management.compiler=HotSpot Client Compiler, os.name=Linux,
persistence.pojo.xmlfilelist=src/test/resources/PojoList.xml,
sun.boot.class.path=/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/resources.jar:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/jsse.jar:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/jce.jar:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/charsets.jar:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/classes,
env.PWD=/home/thierry,
env.XDG_SESSION_COOKIE=b905806326f11e0b772623114a1c05da-1271232614.772432-144904942,
sun.desktop=gnome, env.LANG=en_US.UTF-8, java.vm.specification.vendor=Sun Microsystems
Inc., java.runtime.version=1.6.0_16-b01, env.DISPLAY=:0.0,
hibernate.cache.provider_class=${hibernate.cache.provider_class}, user.name=thierry,
env.USER=thierry, env.SHELL=/bin/bash, env.MOZILLA_FIVE_HOME=/usr/lib/xulrunner-addons,
env.DESKTOP_SESSION=gnome,
env.XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/,
env.NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat,
env.PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games,
user.language=en, sun.boot.library.path=/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/i386,
classworlds.conf=/home/thierry/workspace/.metadata/.plugins/org.maven.ide.eclipse/launches/m2conf8195292387699736565.tmp,
java.version=1.6.0_16, user.timezone=Europe/Paris,
env.DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-K4MHiUhcae,guid=01640d0f119ca6a1030375b74bc57868,
sun.arch.data.model=32, env.SSH_AGENT_PID=2293,
java.endorsed.dirs=/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/endorsed, sun.cpu.isalist=,
sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, file.separator=/,
java.specification.name=Java Platform API Specification, hibernate.format_sql=false,
env.GDMSESSION=gnome, env.GNOME_DESKTOP_SESSION_ID=this-is-deprecated,
java.class.version=50.0, env.GDM_KEYBOARD_LAYOUT=fr,
persistence.pojo.view.creator=com.itscape.persistence.view.mysql.ViewCreatorImpl,
env.GNOME_KEYRING_PID=2233, user.country=US,
java.home=/usr/lib/jvm/java-6-sun-1.6.0.16/jre, java.vm.info=mixed mode, sharing,
env.LOGNAME=thierry, os.version=2.6.31-20-generic, path.separator=:,
java.vm.version=14.2-b01, hibernate.connection.password=passwd,
java.awt.printerjob=sun.print.PSPrinterJob, sun.io.unicode.encoding=UnicodeLittle,
hibernate.connection.username=itscape, env.GDM_LANG=en_US.UTF-8, user.home=/home/thierry,
java.specification.vendor=Sun Microsystems Inc., hibernate.hbm2ddl.auto=update,
java.library.path=/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/../lib/i386:/usr/lib/xulrunner-addons:/usr/java/packages/lib/i386:/lib:/usr/lib,
java.vendor.url=http://java.sun.com/,
hibernate.connection.driver_class=com.mysql.jdbc.Driver, java.vm.vendor=Sun Microsystems
Inc., hibernate.dialect=org.hibernate.dialect.MySQLDialect,
maven.home=/opt/apache-maven-2.2.1, java.runtime.name=Java(TM) SE Runtime Environment,
java.class.path=/opt/apache-maven-2.2.1/boot/classworlds-1.1.jar,
env.XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt, java.vm.specification.name=Java Virtual
Machine Specification, java.vm.specification.version=1.0,
m2eclipse.workspace.state=/home/thierry/workspace/.metadata/.plugins/org.maven.ide.eclipse/workspacestate.properties,
env.GTK_RC_FILES=/etc/gtk/gtkrc:/home/thierry/.gtkrc-1.2-gnome2, sun.cpu.endian=little,
sun.os.patch.level=unknown, env.HOME=/home/thierry,
surefire.test.class.path=/home/thierry/workspace/ITSCAPE/branch/IT-Scape_1_0/IT-Scape/modules/data/trunk/persistence/data-persistence/target/test-classes:/home/thierry/workspace/ITSCAPE/branch/IT-Scape_1_0/IT-Scape/modules/data/trunk/persistence/data-persistence/target/classes:/home/thierry/workspace/ITSCAPE/branch/IT-Scape_1_0/IT-Scape/modules/data/trunk/persistence/model/target/model.jar:/home/thierry/workspace/ITSCAPE/branch/IT-Scape_1_0/IT-Scape/modules/data/trunk/model-serializer/target/model-serializer.jar:/home/thierry/.m2/repository/org/hibernate/hibernate-core/3.5.0-Final/hibernate-core-3.5.0-Final.jar:/home/thierry/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar:/home/thierry/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar:/home/thierry/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/home/thierry/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:/home/thierry/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/home/thierry/.m2/repository/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar:/home/thierry/.m2/repository/org/hibernate/hibernate-annotations/3.5.0-Final/hibernate-annotations-3.5.0-Final.jar:/home/thierry/.m2/repository/org/hibernate/hibernate-commons-annotations/3.2.0.Final/hibernate-commons-annotations-3.2.0.Final.jar:/home/thierry/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar:/home/thierry/.m2/repository/javassist/javassist/3.8.0.GA/javassist-3.8.0.GA.jar:/home/thierry/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar:/home/thierry/.m2/repository/org/json/json/20090211/json-20090211.jar:/home/thierry/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar:/home/thierry/.m2/repository/org/apache/felix/org.osgi.core/1.0.0/org.osgi.core-1.0.0.jar:/home/thierry/.m2/repository/org/slf4j/slf4j-log4j12/1.5.10/slf4j-log4j12-1.5.10.jar:/home/thierry/workspace/ITSCAPE/branch/IT-Scape_1_0/IT-Scape/modules/data/trunk/keystore/target/keystore.jar:/home/thierry/.m2/repository/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar:/home/thierry/.m2/repository/org/testng/testng/5.10/testng-5.10-jdk15.jar:/home/thierry/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/thierry/.m2/repository/org/osgi/osgi_R4_core/1.0/osgi_R4_core-1.0.jar:/home/thierry/.m2/repository/org/osgi/osgi_R4_compendium/1.0/osgi_R4_compendium-1.0.jar:,
env.LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.16/jre/../lib/i386:/usr/lib/xulrunner-addons,
java.io.tmpdir=/tmp,
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi,
env.SSH_AUTH_SOCK=/tmp/keyring-D2aK63/socket.ssh, os.arch=i386,
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment,
java.ext.dirs=/usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/ext:/usr/java/packages/lib/ext,
env.XAUTHORITY=/var/run/gdm/auth-for-thierry-4zaQj6/database,
user.dir=/home/thierry/workspace/ITSCAPE/branch/IT-Scape_1_0/IT-Scape/modules/data/trunk/persistence/data-persistence,
env.SPEECHD_PORT=7560, env.GTK_MODULES=canberra-gtk-module, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM,
basedir=/home/thierry/workspace/ITSCAPE/branch/IT-Scape_1_0/IT-Scape/modules/data/trunk/persistence/data-persistence,
hibernate.cache.use_second_level_cache=false, env.ORBIT_SOCKETDIR=/tmp/orbit-thierry,
env.USERNAME=thierry, env.GNOME_KEYRING_SOCKET=/tmp/keyring-D2aK63/socket,
file.encoding=UTF-8, env.GPG_AGENT_INFO=/tmp/seahorse-YD55iC/S.gpg-agent:2316:1,
java.specification.version=1.6, hibernate.connection.isolation=2,
hibernate.connection.pool_size=10, hibernate.show_sql=false}
SLF4
Reporter: Thierry Brunet
Priority: Critical
I am working on upgrading of my application from Hibernate 3.3.2.GA to 3.5.0 Hibernate
final release.
The HQL queries, which contain associations and joins like for instance
"select ds, mgtrela,element from DataSource join ds.management as mgtrela Join
mgtrela.managedElement as element",
do not work.
I have got the following exception
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2297)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
at org.hibernate.loader.Loader.list(Loader.java:2167)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:448)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at
com.itscape.persistence.event.PersistenceManagerEventTest.test1a_BulkInsert(PersistenceManagerEventTest.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:609)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:532)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:686)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1018)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.runWorkers(TestRunner.java:759)
at org.testng.TestRunner.privateRun(TestRunner.java:592)
at org.testng.TestRunner.run(TestRunner.java:486)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
at org.testng.SuiteRunner.run(SuiteRunner.java:204)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:912)
at org.testng.TestNG.runSuitesLocally(TestNG.java:876)
at org.testng.TestNG.run(TestNG.java:784)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
Caused by: java.sql.SQLException: Column 'OSCatalo1_7_2_' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1093)
at com.mysql.jdbc.ResultSetImpl.getLong(ResultSetImpl.java:2942)
at org.hibernate.type.LongType.get(LongType.java:51)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:173)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
at
org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2267)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1423)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1351)
at org.hibernate.loader.Loader.getRow(Loader.java:1251)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:619)
at org.hibernate.loader.Loader.doQuery(Loader.java:745)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.doList(Loader.java:2294)
... 37 more
My model contains the annotation
@Entity
@Table(name = "core_element"
, uniqueConstraints= @UniqueConstraint(columnNames={ "EId"})
)
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class Element implements Serializable{
..}
@Entity
@Table(name = "core_item")
@Inheritance(strategy = InheritanceType.JOINED)
abstract public class Item extends Element {
}
@MappedSuperclass
public abstract class System extends Item
public void setOSCatalogId(long OSCatalogId) {
this.OSCatalogId = OSCatalogId;
}
public long getOSCatalogId() {
return OSCatalogId;
}
}
Entity
@Table(name = "core_computersystem")
@Inheritance(strategy = InheritanceType.JOINED)
public class ComputerSystem extends System {
}
Remark, my application works correctly with hibernate 3.3.2 GA.
I must pass about 300 unit tests in front of hibernate 3.5.0 so that I can adopt it
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira