|Transaction management in Virgo [message #1058822]
||Wed, 15 May 2013 09:17
| Lars Behnke
Registered: May 2013
After searching this forum and doing some internet research and lots of trial and error, I am still stuck with the question what would be the best option to handle transactions in Virgo. I am using:
- Spring 3.1
- Hibernate 3.6.0
- PostgreSQL 9.2
- Virgo 3.6.1
- Java 7 on Ubuntu 12.10, 64bit
I currently ended up with this design:
- A configuration bundle exports JDBC and hibernate properties as a service.
- All (currently three) OSGi bundles that contain Hibernate entities import these properties as a service. Furthermore, each of these bundles sets up an own pooled datasource, session factory and transaction manager (HibernateTransactionManager).
- A am not using JTA. If an operation spans multiple transactional service calls, a "best effort" strategy handles potential errors.
I am not happy with this solution, though and wonder what is currently considered "best practice" in my scenario.
I'd prefer a solution like this:
- A central registry of persistent entities that all bundles can contribute to.
- A single pooled datasource
- A single session factory that is consumed by all multiple bundles
- A single transaction manager that is consumed by multiple bundles
Is this feasible in an OSGi environment? If so, how??
[Updated on: Tue, 21 May 2013 06:36]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01509 seconds