[jboss-user] [EJB 3.0] - Hibernate: IDENTITY support for DB2 9.7 broken

Juergen.Zimmermann do-not-reply at jboss.com
Tue Jun 23 04:18:08 EDT 2009


I'm having no problems when using DB2 Express-C 9.5.2. However, after upgrading to DB2 Express-C 9.7 Hibernate cannot handle IDENTITY columns. A stacktrace is below.

Hibernate products:
* Hibernate 3.3.1
* Hibernate Common Annotations 3.1.0
* Hibernate Annotations 3.4.0
* Hibernate EntityManager 3.4.0

Stacktrace:
javax.persistence.PersistenceException: org.hibernate.HibernateException: The database returned no natively generated identity value
  | 	at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
  | 	at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)
  | 	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:597)
  | 	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:228)
  | 	at $Proxy60.persist(Unknown Source)
  | 	at de.hska.bestellverwaltung.repository.BestellverwaltungRepositoryImpl.neueBestellung(BestellverwaltungRepositoryImpl.java:177)
  | 	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:597)
  | 	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
  | 	at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  | 	at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  | 	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  | 	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
  | 	at $Proxy65.neueBestellung(Unknown Source)
  | 	at de.hska.bestellverwaltung.service.BestellverwaltungServiceImpl.createBestellung(BestellverwaltungServiceImpl.java:188)
  | 	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:597)
  | 	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
  | 	at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  | 	at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  | 	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  | 	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
  | 	at $Proxy66.createBestellung(Unknown Source)
  | 	at de.hska.test.BestellverwaltungTest.createBestellung(BestellverwaltungTest.java:135)
  | 	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:597)
  | 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  | 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
  | 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  | 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
  | 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
  | 	at org.springframework.test.context.junit4.statements.RunSpringTestContextBefores.evaluate(RunSpringTestContextBefores.java:74)
  | 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
  | 	at org.springframework.test.context.junit4.statements.RunSpringTestContextAfters.evaluate(RunSpringTestContextAfters.java:82)
  | 	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
  | 	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:210)
  | 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44)
  | 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
  | 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
  | 	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
  | 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
  | 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
  | 	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
  | 	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
  | 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
  | 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
  | Caused by: org.hibernate.HibernateException: The database returned no natively generated identity value
  | 	at org.hibernate.id.IdentifierGeneratorFactory.getGeneratedIdentity(IdentifierGeneratorFactory.java:90)
  | 	at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:105)
  | 	at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2186)
  | 	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2666)
  | 	at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
  | 	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
  | 	at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
  | 	at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
  | 	at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
  | 	at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
  | 	at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)
  | 	at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)
  | 	at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)
  | 	at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:645)
  | 	at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:619)
  | 	at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:623)
  | 	at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220)
  | 	... 67 more

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239286#4239286

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239286



More information about the jboss-user mailing list