There are two ways to fix this problem that I can see.
1) Delay the registration of the context with the GlobalTxEntityMap until ejbPostCreate()
returns.
The disadvantage is that this will require retesting of the locking and caching to
make sure we have caught all the cases where delaying the registration of the
synchronization with the transaction does not get an automatic tidyup.
e.g. tx timeout during ejbPostCreate() will not invoke the synchronization anymore
2) Does some fixup to the state of the EntityEnterpriseContext such that
the GlobalTxEntityMap knows not to flush the entity until after the ejbPostCreate
has returned.
e.g. We could in EntitySynchronizationInterceptor do
instance.setTxAssociation(SYNCHRONIZED)
in the invokeHome() and reset it to the default NONE after ejbPostCreate()
This second option would tell the GlobalTxEntityMap that the data is already
synchronized and doesn't need to be flushed,
but this might not interplay very well with the "insertAfterEjbPostCreate"
feature of CMP?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035014#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...