Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0
Mapping documents:
<sql-query name="maxtIdQ">
<return alias="maxId" class="com.telus.togw.services.domain.InstallerChecklist">
</return>
SELECT MAX(ValueID) as {maxId.id} FROM IN_VALUE
</sql-query>
Code between sessionFactory.openSession() and session.close():
<......
dao.updateObject(objArray);
log.debug("getting Max/Last Inst Id.");
instIdList = dao.execute(GET_MAX_INST_ID_QUERY);
log.debug(" getting Max/Last Inst Id query executed.");
......>
Full stack trace of any exception that occurs:
06/11/10 09:27:13 Hibernate: SELECT MAX(ValueID) as ID_Vale1_0_ FROM IN_VALUE
2006-11-10 09:27:13,589 WARN hibernate.util.JDBCExceptionReporter - SQL Error: 17006, SQLState: null
2006-11-10 09:27:13,589 ERROR hibernate.util.JDBCExceptionReporter - Invalid column name
2006-11-10 09:27:13,590 WARN persistence.hibernate.HibernateDao - Error in execute(). : could not execute query
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 persistence.hibernate.HibernateDao.execute(HibernateDao.java:199)
at services.dao.SubscriptionAssuranceDaoImpl.saveInstallerChecklist(SubscriptionAssuranceDaoImpl.java:750)
at svcassurance.subscription.impl.SubscriptionAssuranceImpl.saveInstFeedbackDetails(SubscriptionAssuranceImpl.java:1133)
at svcassurance.subscription.ejb.SubscriptionAssuranceEJB.saveInstFeedbackDetails(SubscriptionAssuranceEJB.java:370)
at SubscriptionAssurance_StatelessSessionBeanWrapper2.saveInstFeedbackDetails(SubscriptionAssurance_StatelessSessionBeanWrapper2.java:2801)
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 com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:124)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:294)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:5799)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:744)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1564)
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.type.AbstractType.hydrate(AbstractType.java:80)
at org.hibernate.persister.entity.BasicEntityPersister.hydrate(BasicEntityPersister.java:1690)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:991)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:942)
at org.hibernate.loader.Loader.getRow(Loader.java:855)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:305)
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)
... 17 more
Name and version of the database you are using: Oracle
The generated SQL (show_sql=true):
SELECT MAX(ValueID) as ID_Vale1_0_ FROM IN_VALUE
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Both query (update and excute as in the code shown above) work perfectly. Sometimes only the execute throws the exception (I see the debug log statement "getting Max/Last Inst Id." in the log file). The exception is;
Please help me to solve this and I'm stuck