I have verified that each of the referenced columns are exact matches to the database. Also, the generated query (repeated below) runs PERFECTLY in Toad.
However, Hibernate tells me:
Code:
10:04:35,428 WARN [JDBCExceptionReporter] SQL Error: 17006, SQLState: null
10:04:35,428 ERROR [JDBCExceptionReporter] [b]Invalid column name[/b]
but Hibernate, inexplicably, does NOT tell me
WHICH column it doesn't like.
Hibernate Version: 3.0.5
Mapping Document:
Code Between session open & close:
<CODE>
Session session = getSession();
List list = null;
try
{
SQLQuery sqlQuery = session.createSQLQuery( pSQLStatement );
sqlQuery.addEntity( "pcl", PricedClaimLineVarianceImpl.class );
sqlQuery.addEntity( "pc", PricedClaimImpl.class );
sqlQuery.addEntity( "pcb", PricedClaimBatchImpl.class );
sqlQuery.addEntity( "cl", ClaimLineImpl.class );
sqlQuery.addEntity( "c", ClaimImpl.class );
sqlQuery.addEntity( "p", PractitionerImpl.class );
sqlQuery.addEntity( "priorPcl", PricedClaimLineVarianceImpl.class );
list = sqlQuery.list();
}
catch( Exception e )
{
mLog.error( "SQLQuery threw an exception", e );
}
finally
{
session.close();
}
</CODE>
Full stack trace of any exception that occurs:
<CODE>
10:04:35,428 WARN [JDBCExceptionReporter] SQL Error: 17006, SQLState: null
10:04:35,428 ERROR [JDBCExceptionReporter] Invalid column name
10:04:57,111 ERROR [ClaimProcessingWorkflowServiceBeanSession] SQLQuery threw an exception
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1596)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:112)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1414)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153)
at com.ingenix.transact.provider.transcontract.workflow.claimprocessing.ejb.ClaimProcessingWorkflowServiceImpl.executeAndCSVFormatRowsUsingJDBC(ClaimProcessingWorkflowServiceImpl.java:1627)
at com.ingenix.transact.provider.transcontract.workflow.claimprocessing.ejb.ClaimProcessingWorkflowServiceImpl.getRecalcExportData(ClaimProcessingWorkflowServiceImpl.java:584)
at com.ingenix.transact.provider.transcontract.workflow.claimprocessing.ejb.ClaimProcessingWorkflowServiceImpl.getRecalcCSVExport(ClaimProcessingWorkflowServiceImpl.java:546)
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:324)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:130)
at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
at org.jboss.ejb.Container.invoke(Container.java:873)
at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
at sun.reflect.GeneratedMethodAccessor161.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:6221)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1557)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at org.jboss.resource.adapter.jdbc.WrappedResultSet.getLong(WrappedResultSet.java:338)
at org.hibernate.type.LongType.get(LongType.java:26)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:759)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:292)
at org.hibernate.loader.Loader.doQuery(Loader.java:412)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
... 45 more
</CODE>
Name and version of the database you are using: Oracle 9i
The generated SQL:
select
c.INVOICE_NUMBER,
cl.LINE_NUMBER,
cl.PROC_CODE,
cl.MODIFIER_LIST,
cl.UNITS,
cl.START_DATE_OF_SERVICE,
cl.POS_CODE,
cl.DIAGNOSIS_LIST,
cl.PRACTITIONER_EID,
p.LASTNAME,
cl.SPECIALTY_CODE,
cl.CHARGED_AMOUNT,
priorPcl.EXPECTED_AMOUNT,
pcl.EXPECTED_AMOUNT,
pcl.ALLOWED_AMOUNT,
pcl.CURRENT_PAID_AMOUNT,
priorPcl.CONTRACTUAL_VARIANCE,
pcl.CONTRACTUAL_VARIANCE,
priorPcl.PAYMENT_VARIANCE,
pcl.PAYMENT_VARIANCE,
priorPcl.CLAIM_LINE_VARIANCE_STATUS, pcl.CLAIM_LINE_VARIANCE_STATUS
from
CLAIM c,
CLAIM_LINE cl,
PRACTITIONER p,
PRICED_CLAIM pc,
PRICED_CLAIM_LINE pcl,
PRICED_CLAIM_LINE priorPcl,
PRICED_CLAIM_BATCH pcb
where
pcb.WORKFLOW_IID = '1055'
and
pcb.PRICED_CLAIM_BATCH_IID = pc.PRICED_CLAIM_BATCH_IID
and
pcl.PRICED_CLAIM_IID = pc.PRICED_CLAIM_IID
and
pc.CLAIM_IID = c.CLAIM_IID
and
c.CLAIM_IID = cl.CLAIM_IID
and
cl.CLAIM_LINE_IID = pcl.CLAIM_LINE_IID
and
cl.PRACTITIONER_EID = p.PRACTITIONER_EID (+)
and
pc.PRIOR_PRICED_CLAIM_IID = priorPcl.PRICED_CLAIM_IID (+)
and
( priorPcl.CLAIM_LINE_IID is null
OR
priorPcl.CLAIM_LINE_IID = pcl.CLAIM_LINE_IID
)
order by
c.INVOICE_NUMBER,
cl.LINE_NUMBER