ejb3.0 and IDENTITY Generated ID problem
lazybeans Apr 18, 2006 6:03 PMI'm using IDENTITY generated Ids. This is for a serial (autoincrement) datatype on the new Informix 10.0 server. I'm getting an error in which ejb cannot return the incremented Id value as evidenced by the error below. Using a previous version of Informix 9.4, it used to work. After it inserts a row, it goes on to do a sql statement specific to informix in which it gets the last autoincremented Id back and puts it into the entity bean. Now, the new version, it doesn't even get to that sql statement anymore, it just dies after it executes the insert statement and rolls back the whole transaction. I called informix and I am using the jdbc driver which is certificated for informix 9.4 and 10. Obviously, there's some difference in the way the two servers behave because it works in one but not the other, but does anybody have any information in which can help me fix this issue myself? Any clues?
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name=DatabaseConstants.USER_COLUMN_ID)
public Integer getId() {
return id;
}
14:54:28,946 INFO [STDOUT] Hibernate: insert into skxshop_user (password, email, registration_date, last_login_date, ca
ncelled, store_id, banned, zip, password_exp_date) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
14:54:28,993 WARN [RequestProcessor] Unhandled Exception thrown: class javax.ejb.EJBException
14:54:28,993 ERROR [[action]] Servlet.service() for servlet action threw exception
javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: The database returned
no natively generated identity value
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:308)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)