Ok, trying to do something VERY simple here, I can't believe no one has done this 
already.

I'm trying to implement a very simple container-managed-persistent Entity Bean in 
JBoss 3.2.3 using the built-in Hypersonic database.  I want the bean to have an 
auto-incremented primary key field.

In fact,  by hand-creating the table with the primary key field as an 'IDENTITY' 
field, I have managed to get it so when you create the bean, it does actually create 
the row in the table with the correct auto-incremented value, but I then get this 
Exception:

javax.ejb.CreateException: Primary key for created instance is null.
        at 
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:556)
        at 
org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:208)
        at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:269)
        at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:737)

(etc., etc.)

I have not been able to figure out why I'm getting this exception or how to prevent it.

I'm not sure what parts of my code to paste here, there's basically no code involved.  
My ejbCreate is:

        public Integer ejbCreate(String name) throws CreateException
        {
                setName(name);
                return new Integer(0);
        }       

Where 'name' is another field in the bean (other than the pk field).  I returned a 
zero in a failed attampt to prevent the exception.

I'm also using Eclipse and JBoss-IDE.

Help!

--Josh

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

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


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to