java.lang.Error: id may not be null / Column 'plant_id' cann
ewlyahoocom Oct 29, 2001 1:08 PMHello,
I'm trying to create some entity beans. I can load them out of my database (using findAll() for example) but when I try to create() a new one I get various errors all seeming to do with some values not getting set (I've pasted one such exception below). I initially got these errors with the 2.2 version so I am now getting the CVS source and compiling but I still get the errors. I've tried it with and without the CMP stuff, with and without the new EJB 2.0 DOCTYPE, with and without MySQL, with different primary keys, with and without "not null" restrictions on the databsae tables but I can't get anything to work.
I've even tried debugging the JBoss server. In org.jboss.ejb.plugins.CMPPersistenceManager.createEntity at about line 219 the line:
Object id = store.createEntity(m, args, ctx);
sets id to null. I've traced down into the call and find that org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute at about line 68:
id = entity.extractPrimaryKeyFromInstance(ctx);
is setting id to null.
Can anyone suggest a way I might get this stuff to work? Or am I fundamentally misunderstanding something about the way entity beans are created?
I apologize if this question has been posted before but I can't seem to search for phrases in these forums.
Thanks,
Emery
ewl@genscape.com
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
javax.transaction.TransactionRolledbackException: id may not be null; nested exception is:
java.lang.Error: id may not be null
javax.transaction.TransactionRolledbackException: id may not be null; nested exception is:
java.lang.Error: id may not be null
java.lang.Error: id may not be null
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invokeHome(Unknown Source)
at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:258)
at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
at $Proxy0.create(Unknown Source)
at com.genscape.beans.Test.main(Test.java:154)
calling plantHome.create(6342)...
javax.ejb.CreateException: Could not create entity:java.sql.SQLException: General error: Column 'plant_name' cannot be null
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invokeHome(Unknown Source)
at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:258)
at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
at $Proxy0.create(Unknown Source)
at com.genscape.beans.Test.main(Test.java:154)