Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Service/DAO/Model Bundles

I need some advice on the organization of bundles for my database application in OSGi.
This is what I was thinking,
1) Model Bundle
This will contain all the Entity objects with annotations also the persistence.xml file and the JPA-PersistenceUnits manifest headers.
2) DAO Bundle
This will contain the DAO classes containing all the get/set/delete methods, but without any transaction semantics.
3) Service Bundle
This will contain all the domain logic and will invoke the DAO classes as appropriate. This method should start and end the transaction. (preferably with some annotation approach)
The problem I'm having is with the sharing of EntityManager instance across the DAO and the Service bundle, since I want the Service to handle all transactional aspects.
The questions I have are,
a) Is there anyway for the DAO bundle to use the Entitymanager created by the Service bundle, without actually passing the EntityManager as a parameter.
b) Also I read that DI annotations like @PersistenceContext does not work in the OSGi container. Is this still true?
c) I would also prefer to use Spring JPA/Spring DM. Has anyone used the Spring OSGi support for wokring with EclipseLink in a similar configuration.

Earn cashback on your purchases with Live Search - the search that pays you back! Learn More

Back to the top