-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: values identity_val_local()
PostPosted: Tue Feb 20, 2007 5:14 pm 
Newbie

Joined: Tue Feb 20, 2007 4:49 pm
Posts: 5
Problem description

We are inserting a record into a table where the primary key is a identity column. The code works fine against DB2 UDB on NT, but fails against DB2 OS/390 7.1.2

Extract from the stack trace is "[2/20/07 10:14:37:568 PST] 00000026 SystemOut O Hibernate: values identity_val_local()
[2/20/07 10:14:37:849 PST] 00000026 JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: -142, SQLState: 42612
"

I looked at the dialect DB2390Dialect and it contains the method

public String getIdentitySelectString()
{
return "select identity_val_local() from sysibm.sysdummy1";
}

Help !

Hibernate version:
3.2.0.cr4



Name and version of the database you are using:

DB2 OS/390 7.1.2

The generated SQL (show_sql=true):

Hibernate: insert into D6744DBT.FRC_CAP (FRC_CAP_ID, DATA_SEG_ID, FRC_CAP_TYP_CD, CONTR_ID, CONTR_LN_ID, POL_ID, ECAP_BEN_PLN_ID, MBR_ID, MBR_ID_SUFX, CAP_PRD_BEGN_YR_MO, CAP_PRD_END_YR_MO, REPROC_CD, CUST_ID, MTCN, UPDT_USER_ID, UPDT_DTTM, CONTR_CHG_TYP_CD) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

Full stack trace of any exception that occurs:
[2/20/07 10:14:36:912 PST] 00000026 NamingHelper I org.hibernate.util.NamingHelper getInitialContext JNDI InitialContext properties:{}
[2/20/07 10:14:36:959 PST] 00000026 SystemOut O Hibernate: insert into D6744DBT.FRC_CAP (FRC_CAP_ID, DATA_SEG_ID, FRC_CAP_TYP_CD, CONTR_ID, CONTR_LN_ID, POL_ID, ECAP_BEN_PLN_ID, MBR_ID, MBR_ID_SUFX, CAP_PRD_BEGN_YR_MO, CAP_PRD_END_YR_MO, REPROC_CD, CUST_ID, MTCN, UPDT_USER_ID, UPDT_DTTM, CONTR_CHG_TYP_CD) values (default, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[2/20/07 10:14:37:568 PST] 00000026 SystemOut O Hibernate: values identity_val_local()
[2/20/07 10:14:37:849 PST] 00000026 JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: -142, SQLState: 42612
[2/20/07 10:14:37:865 PST] 00000026 JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions [IBM][CLI Driver][DB2] SQL0142N The SQL statement is not supported. SQLSTATE=42612

[2/20/07 10:14:37:880 PST] 00000026 SystemOut O org.hibernate.exception.SQLGrammarException: could not retrieve generated id after insert: [com.uhg.ecs.bl.dao.common.ForceCap]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:69)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2093)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2573)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:47)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
at com.uhg.ecs.bl.dao.forceCap.ForceCapDAO.updateOrSaveForceCapParameter(ForceCapDAO.java:197)
at com.uhg.ecs.bl.ejb.forceCap.ForceCapSessionBean.updateOrSaveForceCapParameter(ForceCapSessionBean.java:58)
at com.uhg.ecs.bl.ejb.forceCap.EJSRemoteStatelessForceCapSession_beb8bb74.updateOrSaveForceCapParameter(EJSRemoteStatelessForceCapSession_beb8bb74.java:65)
at com.uhg.ecs.bl.ejb.forceCap._ForceCapSession_Stub.updateOrSaveForceCapParameter(_ForceCapSession_Stub.java:359)
at com.uhg.ecs.ui.action.forceCap.ForceCapService.updateOrSave(ForceCapService.java:48)
at com.uhg.ecs.ui.action.forceCap.ForceCapAddAction.execute(ForceCapAddAction.java:59)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:89)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1878)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1462)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0142N The SQL statement is not supported. SQLSTATE=42612

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeQuery(Unknown Source)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteQuery(WSJdbcPreparedStatement.java:667)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java:477)
at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:55)
... 40 more

[2/20/07 10:14:37:896 PST] 00000026 AssertionFail E org.hibernate.AssertionFailure <init> an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: null id in com.uhg.ecs.bl.dao.common.ForceCap entry (don't flush the Session after an exception occurs)
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:55)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:157)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$1.invoke(WebSphereExtendedJTATransactionLookup.java:136)
at $Proxy0.beforeCompletion(Unknown Source)
at com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.beforeCompletion(SynchronizationCallbackWrapper.java:65)
at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:182)
at com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(TransactionImpl.java:2270)
at com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:1521)
at com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(TransactionImpl.java:1492)
at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(TransactionImpl.java:1427)
at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(TranManagerImpl.java:236)
at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(TranManagerSet.java:157)
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:716)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:167)
at com.ibm.ejs.csi.TranStrategy.handleException(TranStrategy.java:210)
at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:571)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3801)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3623)
at com.uhg.ecs.bl.ejb.forceCap.EJSRemoteStatelessForceCapSession_beb8bb74.updateOrSaveForceCapParameter(EJSRemoteStatelessForceCapSession_beb8bb74.java:81)
at com.uhg.ecs.bl.ejb.forceCap._ForceCapSession_Stub.updateOrSaveForceCapParameter(_ForceCapSession_Stub.java:359)
at com.uhg.ecs.ui.action.forceCap.ForceCapService.updateOrSave(ForceCapService.java:48)
at com.uhg.ecs.ui.action.forceCap.ForceCapAddAction.execute(ForceCapAddAction.java:59)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:89)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1878)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1462)

[2/20/07 10:14:37:912 PST] 00000026 RegisteredSyn E WTRN0074E: Exception caught from before_completion synchronization operation: java.lang.UnsupportedOperationException
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter.setRollbackOnly(WebSphereExtendedJTATransactionLookup.java:211)
at org.hibernate.transaction.CacheSynchronization.setRollbackOnly(CacheSynchronization.java:73)
at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:63)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$1.invoke(WebSphereExtendedJTATransactionLookup.java:136)
at $Proxy0.beforeCompletion(Unknown Source)
at com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.beforeCompletion(SynchronizationCallbackWrapper.java:65)
at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:182)
at com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(TransactionImpl.java:2270)
at com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:1521)
at com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(TransactionImpl.java:1492)
at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(TransactionImpl.java:1427)
at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(TranManagerImpl.java:236)
at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(TranManagerSet.java:157)
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:716)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:167)
at com.ibm.ejs.csi.TranStrategy.handleException(TranStrategy.java:210)
at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:571)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3801)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3623)
at com.uhg.ecs.bl.ejb.forceCap.EJSRemoteStatelessForceCapSession_beb8bb74.updateOrSaveForceCapParameter(EJSRemoteStatelessForceCapSession_beb8bb74.java:81)
at com.uhg.ecs.bl.ejb.forceCap._ForceCapSession_Stub.updateOrSaveForceCapParameter(_ForceCapSession_Stub.java:359)
at com.uhg.ecs.ui.action.forceCap.ForceCapService.updateOrSave(ForceCapService.java:48)
at com.uhg.ecs.ui.action.forceCap.ForceCapAddAction.execute(ForceCapAddAction.java:59)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:89)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1878)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1462)

[2/20/07 10:14:38:271 PST] 00000026 SystemOut O error.general

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 5:58 pm 
Newbie

Joined: Tue Feb 20, 2007 4:49 pm
Posts: 5
The problem was because i was not using the correct dialect.

The problem is resolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.