Hi All, I have a question about how cross bundle transactions are handled with OSGi JPA and JTA. I read the JPA and JTA service specification in OSGi Enterprise Specification 4.2 and browsed in the source code of Apache Aries.
With OSGi JPA Service, each Persistent Bundle provides its own entity classes and a persistence context (e.g. in persistence.xml). For each persistence unit, the JPA provider registers an Entity Manager Factory (Builder) service, which can be retrieved as a service by a Client Bundle to save or retrieve objects in the Persistent Bundle. My Question is concerned with cross-bundle transactions, i.e., transactions which span serveral Persistent Bundles. In particular, I am interested in these transactions, where the persistent bundles share the same datasource. This is a typical situation in enterprise applications. I assume, due to the introduction of multiple Entity Managers, multiple sessions will be opened for a cross-bundle transaction. Is it correct? To ensure atomicity of a cross-bundle transaction with a shared datasource, the sessions opened by each involved Persistent Bundle must be synchronized, e.g. by sharing the same database connection. As far as I understand OSGi JTA transaction service specification, it focuses on distributed transactions which use two-phase commit (TPC) to ensure atomicity. Although a TPC can be used to synchronize cross-bundle transactions described above, it seems to me that it is unnecessarily complex and expensive when considering that the transaction is actually backed by the same datasource. I looked at the source code of org.apache.aries.transaction.GeronimoPlatformTransactionManager in the Apache Aries project. Internally, GeronimoPlatformTransactionManager uses Spring's JtaTransactionManager. So I got the impression that Apache Aries is handling all cross-bundle transactions with a two-phase commit process. Do I understand correctly? Best regards, Yun Dr. Yun Ding | Software Architect | Development & Delivery InterComponentWare AG | Altrottstraße 31 | 69190 Walldorf (Baden) | Germany yun.d...@icw.de | www.icw.de InterComponentWare AG: Vorstand: Peter Kirschbauer (Vors.), Jörg Stadler Aufsichtsratsvors.: Prof. Dr. Christof Hettich Firmensitz: 69190 Walldorf, Altrottstraße 31 AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev