On Jan 9, 2007, at 7:53 AM, Andrus Adamchik wrote:
From the first glance, we can provide all these with minimal
effort. This overlaps with standard JPA callbacks (with the
exception of detach I believe) that Cayenne supports already.
Let me know when the interface is ready and I can add support or you
can post a patch :)
BTW, before we move on with the assembly for TCK, is there anything
in OpenEJB (or Geronimo) that would help us to do in-container
integration testing on our end? Currently we only test the J2SE
provider flavor.
I just committed the JtaEntityManager and JtaEntityManagerRegistry to
the openejb-persistence module. You can create a JtaEntityManager
with the following code:
JtaEntityManagerRegistry registry = new JtaEntityManagerRegistry
(transactionSynchronizationRegistry);
EntityManager entityManager = new JtaEntityManager(registry,
entityManagerFactory,
properties,
extended);
That's it. The under the covers of the JtaEntityManager a new
EntityManager instance is created using the EMF for each transaction.
A single instance of the JtaEntityManagerRegistry should be shared
by all JtaEntityManagers. TransactionSynchronization registry is a
new interface in JTA 1.1. The Geronimo JTA 1.1 transaction manager
implements this interface directly, but if you are not using that
transaction manager just wrap your transaction manager with the
openejb SimpleTransactionSynchronizationRegistry.
If you want to test extended entity managers (only used by stateful
session beans), you will need to simulate stateful session bean
construction, entrance, exit and starting of user transactions by
call in the appropriate method on the JtaEntityManagerRegistry.
If you run into problems, don't hesitate to ask.
-dain