From: <leg...@at...> - 2003-07-12 07:50:43
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-186 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-186 Summary: Problem in SQL generation with ".class" queries + "iterate()" Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.0.1 Assignee: Reporter: Fabio Tudone Created: Sat, 12 Jul 2003 2:50 AM Updated: Sat, 12 Jul 2003 2:50 AM Environment: Windows 2000, WSAD 5 JVM (IBM 1.3) Description: I'm having a strange problem in Hibernate 2.0.1 when using the session.createQuery() + query.iterate() APIs. My mapping is the following: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "--//Hibernate/Hibernate Mapping DTD//EN" "hibernate-mapping-2.0.dtd"> <hibernate-mapping auto-import="false" default-cascade="save-update"> <class name="test.model.Super"> <composite-id> <key-property name="id"/> </composite-id> <property name="superAttr"/> <joined-subclass name="test.model.Sub1"> <key> <column name="id"/> </key> <property name="sub1Attr"/> </joined-subclass> <joined-subclass name="test.model.Sub2"> <key> <column name="id"/> </key> <property name="sub2Attr"/> </joined-subclass> </class> </hibernate-mapping> The following code works perfectly: ... Transaction t = s.beginTransaction(); List l = s.find("from test.model.Super o where o.class = test.model.Sub1"); t.commit(); ... On the other hand, the following code hangs: ... Transaction t = s.beginTransaction(); Query q = s.createQuery("from test.model.Super o where o.class = test.model.Sub1"); Iterator it = q.iterate(); while (it.hasNext()) { Object o = it.next(); } t.commit(); ... The following SQL select query is generated by Hibernate upon the q.iterate() call: select super0_.id as x0_0_ from Super super0_ where (case when super0__1.id is not null then 1 when super0__2.id is not null then 2 when super0_.id is not null then 0 end=0 ) And the following exception is thrown by Oracle: [ERROR] JDBCExceptionReporter - -Could not execute query <java.sql.SQLException: ORA-00904: "SUPER0__2"."ID": invalid identifier >java.sql.SQLException: ORA-00904: "SUPER0__2"."ID": invalid identifier at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2321) at oracle.jdbc.oci8.OCIDBAccess.parseExecuteDescribe(OCIDBAccess.java:1255) at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:527) at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:62) at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:539) at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:789) at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1422) at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:64) at test.query.TestQueryIter.main(TestQueryIter.java:58) java.sql.SQLException: ORA-00904: "SUPER0__2"."ID": invalid identifier at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2321) at oracle.jdbc.oci8.OCIDBAccess.parseExecuteDescribe(OCIDBAccess.java:1255) at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:527) at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:62) at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:539) at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:789) at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1422) at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:64) at test.query.TestQueryIter.main(TestQueryIter.java:58) rethrown as net.sf.hibernate.JDBCException: Could not execute query: ORA-00904: "SUPER0__2"."ID": invalid identifier at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1425) at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:64) at test.query.TestQueryIter.main(TestQueryIter.java:58) --------------------------------------------------------------------- JIRA INFORMATION: 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.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |