-
1. Re: <insert-after-ejb-post-create>true</insert-after-ejb-pos
ais Aug 5, 2004 10:35 AM (in response to ais)solved
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 ) -
2. Re: <insert-after-ejb-post-create>true</insert-after-ejb-pos
ais Aug 6, 2004 2:26 AM (in response to ais)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-configurations>
<container-configuration extends="Standard CMP 2.x EntityBean">
<container-name>INSERTPOSTCREATE</container-name>
<insert-after-ejb-post-create>true</insert-after-ejb-post-create>
</container-configuration>
</container-configurations>
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).
HTH -
3. Re: <insert-after-ejb-post-create>true</insert-after-ejb-pos
aloubyansky Aug 6, 2004 4:39 AM (in response to ais)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.