the problem is that you must set a dummy id in ejbCreate (this is a dummy id if the id will be generated by the database server )
i wanted to post a more clear explanation.
I was able to configure jboss to delay the insert after ejbpost create.
In order to do this, the following lines must be added to jboss.xml:
<container-configuration extends="Standard CMP 2.x EntityBean">
Another thing that must be done, is to mark the entity beans to use this configuration (this is also done in jboss.xml)
The last thing that must be done, when the primary key is generated by the database server, is to set a dummy id for the entity bean in ejbCreate, something like: setId(new Integer(DUMMY_ID)); this will be overwritten by the database server with the right id. This hack must we done, otherwise an CreateException will be thrown (this is probably a jboss bug for now - not taking in account the fact that the primary key will be generated by the database server).
It's not safe in the current implementation. A real primary key must be available after ejbCreate and before ejbPostCreate. This is the spec by the way.