I am writing both the queries from console.These looks same to me.
From Hypersonic: This works fine
Code:
Hibernate: select patient0_.PATIENT_ID as PATIENT1_0_1_, patient0_.VERSION as VERSION0_1_, patient0_.PATIENT_NAME as PATIENT3_0_1_, patient0_.CPI_NUMBER as CPI4_0_1_, patient0_.CREATED as CREATED0_1_, patient0_.LAST_APPOINTMENT_ID as LAST6_0_1_, entry1_.WORKITEM_ID as WORKITEM1_4_0_, entry1_.VERSION as VERSION4_0_, entry1_.PATIENT_NAME as PATIENT3_4_0_, entry1_.CPI_NUMBER as CPI4_4_0_, entry1_.BEGIN_DATE as BEGIN5_4_0_, entry1_.CREATED as CREATED4_0_, entry1_.STATUS as STATUS4_0_, entry1_.USER_ID as USER8_4_0_, entry1_.SUSPEND_BY as SUSPEND9_4_0_, entry1_.FORWARD_BY as FORWARD10_4_0_, entry1_.SUSPEND_DATE as SUSPEND11_4_0_, entry1_.QUEUE_ID as QUEUE12_4_0_, entry1_.PATIENT_ID as PATIENT13_4_0_ from PATIENT patient0_ left outer join TBW_ENTRY entry1_ on patient0_.PATIENT_ID=entry1_.PATIENT_ID where patient0_.PATIENT_ID=?
From oracle: This is giving the exception
Hibernate: select patient0_.PATIENT_ID as PATIENT1_0_1_, patient0_.VERSION as VERSION0_1_, patient0_.PATIENT_NAME as PATIENT3_0_1_, patient0_.CPI_NUMBER as CPI4_0_1_, patient0_.CREATED as CREATED0_1_, patient0_.LAST_APPOINTMENT_ID as LAST6_0_1_, entry1_.WORKITEM_ID as WORKITEM1_4_0_, entry1_.VERSION as VERSION4_0_, entry1_.PATIENT_NAME as PATIENT3_4_0_, entry1_.CPI_NUMBER as CPI4_4_0_, entry1_.BEGIN_DATE as BEGIN5_4_0_, entry1_.CREATED as CREATED4_0_, entry1_.STATUS as STATUS4_0_, entry1_.USER_ID as USER8_4_0_, entry1_.SUSPEND_BY as SUSPEND9_4_0_, entry1_.FORWARD_BY as FORWARD10_4_0_, entry1_.SUSPEND_DATE as SUSPEND11_4_0_, entry1_.QUEUE_ID as QUEUE12_4_0_, entry1_.PATIENT_ID as PATIENT13_4_0_ from PATIENT patient0_, TBW_ENTRY entry1_ where patient0_.PATIENT_ID=entry1_.PATIENT_ID(+) and patient0_.PATIENT_ID=?
Exception Trcae:
Hibernate: select patient0_.PATIENT_ID as PATIENT1_0_, patient0_.VERSION as VERSION0_, patient0_.PATIENT_NAME as PATIENT3_0_, patient0_.CPI_NUMBER as CPI4_0_, patient0_.CREATED as CREATED0_, patient0_.LAST_APPOINTMENT_ID as LAST6_0_ from PATIENT patient0_ where patient0_.CPI_NUMBER=?
Hibernate: select entry0_.WORKITEM_ID as WORKITEM1_4_0_, entry0_.VERSION as VERSION4_0_, entry0_.PATIENT_NAME as PATIENT3_4_0_, entry0_.CPI_NUMBER as CPI4_4_0_, entry0_.BEGIN_DATE as BEGIN5_4_0_, entry0_.CREATED as CREATED4_0_, entry0_.STATUS as STATUS4_0_, entry0_.USER_ID as USER8_4_0_, entry0_.SUSPEND_BY as SUSPEND9_4_0_, entry0_.FORWARD_BY as FORWARD10_4_0_, entry0_.SUSPEND_DATE as SUSPEND11_4_0_, entry0_.QUEUE_ID as QUEUE12_4_0_, entry0_.PATIENT_ID as PATIENT13_4_0_ from TBW_ENTRY entry0_ where entry0_.PATIENT_ID=?
Exception Trace:
Code:
11:07:49,288 WARN JDBCExceptionReporter:71 - SQL Error: 904, SQLState: 42000
11:07:49,288 ERROR JDBCExceptionReporter:72 - ORA-00904: "ENTRY0_"."PATIENT_ID": invalid identifier
org.hibernate.exception.SQLGrammarException: could not load an entity: [edu.umich.med.pbs.domain.model.Entry#218]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1796)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:47)
at org.hibernate.loader.entity.EntityLoader.loadByUniqueKey(EntityLoader.java:85)
at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1512)
at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:365)
at org.hibernate.type.EntityType.resolve(EntityType.java:306)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
at org.hibernate.loader.Loader.doList(Loader.java:2147)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)
at org.hibernate.loader.Loader.list(Loader.java:2021)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:296)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:992)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:650)
at edu.umich.med.pbs.dataload.hibernate.TestLoad.loadOTISData(TestLoad.java:92)
at edu.umich.med.pbs.dataload.hibernate.TestLoad.main(TestLoad.java:43)
Caused by: java.sql.SQLException: ORA-00904: "ENTRY0_"."PATIENT_ID": invalid identifier
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:643)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1674)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1870)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:314)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:137)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1676)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1782)
... 19 more