Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: problem with @GeneratedId in DB2,Websphere and JPA/Hibernate
PostPosted: Fri Aug 24, 2012 10:40 am 
Newbie

Joined: Fri Aug 24, 2012 9:42 am
Posts: 2
Hi,

I am running into problems when persisting an Entity using hibernate in an ejb application and I would really need your help. The problem seems to relate to the @GeneratedId strategy IDENTITY.

First of all the environment:
* hibernate 3.6.10
* DB2 V 10
* Webspher 8.5


Second the test scenario:
(1) DB
I try to write to table
Code:
EXPERIMENT(ID INTEGER(10) PRIMARY KEY, NAME VARCHAR(255));

An SQL insert of the form: INSERT INTO EXPERIMENT(NAME) VALUES ("my name"); works perfectly and generates a new ID into the the row.

(2) Entity Beans and EJB

The entity bean looks like this, the id generation strategy is IDENTITY!

Code:
@Entity
public class Experiment implements Serializable {
   private static final long serialVersionUID = 1L;

   @Id
   @GeneratedValue(strategy=GenerationType.IDENTITY)
   private int id;

   private String name;

....
}


The Stateless ejb with persistence context and the add method:

Code:
@Stateless
public class DBConnection_Server_Admin{

   @PersistenceContext(name="server_admin")
   EntityManager em;

       public void addExperiment() {
      Experiment e = new Experiment();
                e.setName("My Experiment");
      em.persist(e);
   }
       ...
}


(3) The persistence XML hopefully defines the perstence context correctly:

Code:
<persistence-unit name="server_admin" transaction-type="JTA">
           <provider>org.hibernate.ejb.HibernatePersistence</provider>
           <jta-data-source>jdbc/DB2 für Linux, UNIX und Windows - Neu</jta-data-source>
           <class>com.sandbox.db.Experiment</class>
           <properties>
             <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
             <property name="hibernate.default_catalog" value="SERVER_ADMIN"/>
             <property name="hibernate.show.sql" value="true"/>
             <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
           </properties>
</persistence-unit>



Third the problem and the exceptions:

On em.persist(e) hibernate generates an insert statement leading to a jdbc expcetion. The Application attempts to insert null into the id column. Here a sketch of the exceptions.

Code:
Caused by: com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=2, TABLEID=771, COLNO=0, DRIVER=3.63.123

further causing the
Code:
Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [com.sandbox.db.Experiment]


The hibernate log contains the statement sent to the database:
Code:
2012-08-24 16:13:50 DEBUG [WebContainer : 0 logExceptions 225] org.hibernate.util.JDBCExceptionReporter: could not insert: [com.sandbox.db.Experiment] [insert into SERVER_ADMIN.Experiment (id, name) values (null, ?)]

(the remainder of the log is at the end)
My current conclusion:

Hibernate resp my hibernate setup seems to somehow miss the @GeneratedId strategy and generates a preparedstatement containing the id column with a null value.
I tested additionally:
* SELECT and DELETE on the entity manager works.
* plain sql INSERT using the same jdbc driver works.
* the same code using openEJB as persistence provider works.
* using hibernate in a non EntityManager scenario works.


I am pretty stuck right now and I would really apreciate any help on this issue.

Thank you,

Dietmar


Code:

the hibernate log:
2012-08-24 16:13:50 DEBUG [WebContainer : 0 <init> 265] org.hibernate.impl.SessionImpl: opened session at timestamp: 13458176308
2012-08-24 16:13:50 TRACE [WebContainer : 0 registerSynchronizationIfPossible 201] org.hibernate.jdbc.JDBCContext: TransactionFactory reported no active transaction; Synchronization not registered
2012-08-24 16:13:50 DEBUG [WebContainer : 0 joinTransaction 1164] org.hibernate.ejb.AbstractEntityManagerImpl: Looking for a JTA transaction to join
2012-08-24 16:13:50 DEBUG [WebContainer : 0 registerSynchronizationIfPossible 220] org.hibernate.jdbc.JDBCContext: successfully registered Synchronization
2012-08-24 16:13:50 TRACE [WebContainer : 0 joinTransaction 1193] org.hibernate.ejb.AbstractEntityManagerImpl: Adding flush() and close() synchronization
2012-08-24 16:13:50 TRACE [WebContainer : 0 setFlushMode 1436] org.hibernate.impl.SessionImpl: setting flush mode to: AUTO
2012-08-24 16:13:50 TRACE [WebContainer : 0 setCacheMode 1455] org.hibernate.impl.SessionImpl: setting cache mode to: NORMAL
2012-08-24 16:13:50 TRACE [WebContainer : 0 isUnsaved 127] org.hibernate.engine.IdentifierValue: id unsaved-value: 0
2012-08-24 16:13:50 TRACE [WebContainer : 0 getEntityState 533] org.hibernate.event.def.AbstractSaveEventListener: transient instance of: com.sandbox.db.Experiment
2012-08-24 16:13:50 TRACE [WebContainer : 0 entityIsTransient 194] org.hibernate.event.def.DefaultPersistEventListener: saving transient instance
2012-08-24 16:13:50 TRACE [WebContainer : 0 performSave 175] org.hibernate.event.def.AbstractSaveEventListener: saving [com.sandbox.db.Experiment#<null>]
2012-08-24 16:13:50 TRACE [WebContainer : 0 performSaveOrReplicate 285] org.hibernate.event.def.AbstractSaveEventListener: executing insertions
2012-08-24 16:13:50 DEBUG [WebContainer : 0 performSaveOrReplicate 319] org.hibernate.event.def.AbstractSaveEventListener: executing identity-insert immediately
2012-08-24 16:13:50 TRACE [WebContainer : 0 insert 2331] org.hibernate.persister.entity.AbstractEntityPersister: Inserting entity: com.sandbox.db.Experiment (native id)
2012-08-24 16:13:50 DEBUG [WebContainer : 0 logOpenPreparedStatement 410] org.hibernate.jdbc.AbstractBatcher: about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2012-08-24 16:13:50 DEBUG [WebContainer : 0 openConnection 444] org.hibernate.jdbc.ConnectionManager: opening JDBC connection
2012-08-24 16:13:50 DEBUG [WebContainer : 0 logStatement 111] org.hibernate.SQL: insert into SERVER_ADMIN.Experiment (id, name) values (null, ?)
2012-08-24 16:13:50 TRACE [WebContainer : 0 getPreparedStatement 513] org.hibernate.jdbc.AbstractBatcher: preparing statement
2012-08-24 16:13:50 TRACE [WebContainer : 0 dehydrate 2179] org.hibernate.persister.entity.AbstractEntityPersister: Dehydrating entity: [com.sandbox.db.Experiment#<null>]
2012-08-24 16:13:50 TRACE [WebContainer : 0 bind 82] org.hibernate.type.descriptor.sql.BasicBinder: binding parameter [1] as [VARCHAR] - insert
2012-08-24 16:13:50 DEBUG [WebContainer : 0 logClosePreparedStatement 418] org.hibernate.jdbc.AbstractBatcher: about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2012-08-24 16:13:50 TRACE [WebContainer : 0 closePreparedStatement 562] org.hibernate.jdbc.AbstractBatcher: closing statement
2012-08-24 16:13:50 DEBUG [WebContainer : 0 aggressiveRelease 427] org.hibernate.jdbc.ConnectionManager: aggressively releasing JDBC connection
2012-08-24 16:13:50 DEBUG [WebContainer : 0 closeConnection 464] org.hibernate.jdbc.ConnectionManager: releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2012-08-24 16:13:50 DEBUG [WebContainer : 0 logExceptions 225] org.hibernate.util.JDBCExceptionReporter: could not insert: [com.sandbox.db.Experiment] [insert into SERVER_ADMIN.Experiment (id, name) values (null, ?)]
com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=2, TABLEID=771, COLNO=0, DRIVER=3.63.123
   at com.ibm.db2.jcc.am.fd.a(fd.java:675)
   at com.ibm.db2.jcc.am.fd.a(fd.java:60)
   at com.ibm.db2.jcc.am.fd.a(fd.java:127)
   at com.ibm.db2.jcc.am.ho.c(ho.java:2644)
   at com.ibm.db2.jcc.am.ho.a(ho.java:2124)
   at com.ibm.db2.jcc.t4.cb.o(cb.java:844)
   at com.ibm.db2.jcc.t4.cb.j(cb.java:266)
   at com.ibm.db2.jcc.t4.cb.d(cb.java:55)
   at com.ibm.db2.jcc.t4.q.c(q.java:44)
   at com.ibm.db2.jcc.t4.sb.j(sb.java:147)
   at com.ibm.db2.jcc.am.ho.ib(ho.java:2119)
   at com.ibm.db2.jcc.am.io.b(io.java:4268)
   at com.ibm.db2.jcc.am.io.dc(io.java:759)
   at com.ibm.db2.jcc.am.io.executeUpdate(io.java:742)
   at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteUpdate(WSJdbcPreparedStatement.java:1185)
   at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:802)
   at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:93)
   at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:56)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2346)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2853)
   at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
   at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:320)
   at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129)
   at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:69)
   at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:201)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:147)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:71)
   at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:808)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:782)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:786)
   at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:839)
   at com.ibm.ws.jpa.management.JPAExEmInvocation.persist(JPAExEmInvocation.java:317)
   at com.ibm.ws.jpa.management.JPAEntityManager.persist(JPAEntityManager.java:143)
   at com.sandbox.db.DBConnection_Server_Admin.addExperiment(DBConnection_Server_Admin.java:102)
   at com.sandbox.db.EJSLocalNSLDBConnection_Server_Admin_b6da73f6.addExperiment(EJSLocalNSLDBConnection_Server_Admin_b6da73f6.java)
   at com.sandbox.ejb.AdminService.getInformationLocal(AdminService.java:73)
   at com.sandbox.api.EJSLocal1SLAdminService_db40b6d0.getInformationLocal(EJSLocal1SLAdminService_db40b6d0.java)
   at com.sandbox.ejb.ServiceFacade.getLocalInformation(ServiceFacade.java:67)
   at com.sandbox.ejb.EJSLocalNSLServiceFacade_a05ee74f.getLocalInformation(EJSLocalNSLServiceFacade_a05ee74f.java)
   at com.sandbox.webservice.ServiceFacadeDelegate.getLocalInformation(ServiceFacadeDelegate.java:60)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
   at java.lang.reflect.Method.invoke(Method.java:611)
   at org.apache.axis2.jaxws.server.dispatcher.JavaDispatcher.invokeTargetOperation(JavaDispatcher.java:101)
   at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:118)
   at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:111)
   at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
   at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:198)
   at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
   at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1544)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1214)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
   at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
   at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1027)
   at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
   at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)
   at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
   at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:522)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:311)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:282)
   at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
   at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
   at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
   at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
   at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
   at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
   at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
   at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
   at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
   at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1783)
2012-08-24 16:13:50 WARN  [WebContainer : 0 logExceptions 233] org.hibernate.util.JDBCExceptionReporter: SQL Error: -407, SQLState: 23502
2012-08-24 16:13:50 ERROR [WebContainer : 0 logExceptions 234] org.hibernate.util.JDBCExceptionReporter: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=2, TABLEID=771, COLNO=0, DRIVER=3.63.123
2012-08-24 16:13:50 DEBUG [WebContainer : 0 markAsRollback 1116] org.hibernate.ejb.AbstractEntityManagerImpl: mark transaction for rollback
2012-08-24 16:13:50 ERROR [WebContainer : 0 handlePersistenceException 1300] org.hibernate.ejb.AbstractEntityManagerImpl: Unable to mark for rollback on PersistenceException:
java.lang.UnsupportedOperationException
   at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.setRollbackOnly(WebSphereExtendedJTATransactionLookup.java:161)
   at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:1132)
   at org.hibernate.ejb.AbstractEntityManagerImpl.handlePersistenceException(AbstractEntityManagerImpl.java:1296)
   at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1390)
   at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1317)
   at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1323)
   at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:845)
   at com.ibm.ws.jpa.management.JPAExEmInvocation.persist(JPAExEmInvocation.java:317)
   at com.ibm.ws.jpa.management.JPAEntityManager.persist(JPAEntityManager.java:143)
   at com.sandbox.db.DBConnection_Server_Admin.addExperiment(DBConnection_Server_Admin.java:102)
   at com.sandbox.db.EJSLocalNSLDBConnection_Server_Admin_b6da73f6.addExperiment(EJSLocalNSLDBConnection_Server_Admin_b6da73f6.java)
   at com.sandbox.ejb.AdminService.getInformationLocal(AdminService.java:73)
   at com.sandbox.api.EJSLocal1SLAdminService_db40b6d0.getInformationLocal(EJSLocal1SLAdminService_db40b6d0.java)
   at com.sandbox.ejb.ServiceFacade.getLocalInformation(ServiceFacade.java:67)
   at com.sandbox.ejb.EJSLocalNSLServiceFacade_a05ee74f.getLocalInformation(EJSLocalNSLServiceFacade_a05ee74f.java)
   at com.sandbox.webservice.ServiceFacadeDelegate.getLocalInformation(ServiceFacadeDelegate.java:60)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
   at java.lang.reflect.Method.invoke(Method.java:611)
   at org.apache.axis2.jaxws.server.dispatcher.JavaDispatcher.invokeTargetOperation(JavaDispatcher.java:101)
   at org.apache.axis2.jaxws.server.dispatcher.JavaBeanDispatcher.invoke(JavaBeanDispatcher.java:118)
   at org.apache.axis2.jaxws.server.EndpointController.invoke(EndpointController.java:111)
   at org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:161)
   at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:198)
   at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
   at com.ibm.ws.websvcs.transport.http.WASAxis2Servlet.doPost(WASAxis2Servlet.java:1544)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1214)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
   at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
   at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1027)
   at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
   at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)
   at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
   at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:522)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:311)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:282)
   at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
   at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
   at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
   at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
   at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
   at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
   at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
   at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
   at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
   at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1783)
2012-08-24 16:13:50 TRACE [WebContainer : 0 afterCompletion 58] org.hibernate.transaction.synchronization.HibernateSynchronizationImpl: JTA sync : afterCompletion(5)
2012-08-24 16:13:50 TRACE [WebContainer : 0 afterCompletion 140] org.hibernate.transaction.synchronization.CallbackCoordinator: transaction after completion callback [status=5]
2012-08-24 16:13:50 TRACE [WebContainer : 0 afterTransactionCompletion 263] org.hibernate.jdbc.JDBCContext: after transaction completion
2012-08-24 16:13:50 TRACE [WebContainer : 0 afterTransactionCompletion 600] org.hibernate.impl.SessionImpl: after transaction completion
2012-08-24 16:13:50 TRACE [WebContainer : 0 registerSynchronizationIfPossible 201] org.hibernate.jdbc.JDBCContext: TransactionFactory reported no active transaction; Synchronization not registered
2012-08-24 16:13:50 TRACE [WebContainer : 0 registerSynchronizationIfPossible 201] org.hibernate.jdbc.JDBCContext: TransactionFactory reported no active transaction; Synchronization not registered
2012-08-24 16:13:50 TRACE [WebContainer : 0 registerSynchronizationIfPossible 201] org.hibernate.jdbc.JDBCContext: TransactionFactory reported no active transaction; Synchronization not registered
2012-08-24 16:13:50 TRACE [WebContainer : 0 registerSynchronizationIfPossible 201] org.hibernate.jdbc.JDBCContext: TransactionFactory reported no active transaction; Synchronization not registered
2012-08-24 16:13:50 TRACE [WebContainer : 0 close 318] org.hibernate.impl.SessionImpl: closing session
2012-08-24 16:13:50 TRACE [WebContainer : 0 cleanup 398] org.hibernate.jdbc.ConnectionManager: connection already null in cleanup : no action


Top
 Profile  
 
 Post subject: Re: problem with @GeneratedId in DB2,Websphere and JPA/Hibernate
PostPosted: Mon Aug 27, 2012 3:29 am 
Newbie

Joined: Fri Aug 24, 2012 9:42 am
Posts: 2
Hi,

it was of course a configuration issue: I defined
Code:
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
instead of DB2Dialect. I don't know why i did this.

Anyway, the generated preparedstatement works perfectly:
Code:
2012-08-27 09:17:42 DEBUG [WebContainer : 0 openConnection 444] org.hibernate.jdbc.ConnectionManager: opening JDBC connection
2012-08-27 09:17:42 DEBUG [WebContainer : 0 logStatement 111] org.hibernate.SQL: insert into SERVER_ADMIN.Experiment (id, name) values (default, ?)
2012-08-27 09:17:42 TRACE [WebContainer : 0 getPreparedStatement 513] org.hibernate.jdbc.AbstractBatcher: preparing statement



Best regards,

Dietmar


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.