Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsjpa entities in different bundles under virgo
https://www.eclipse.org/forums/index.php/mv/msg/210679/676867/#msg_676867
Did anybody try under Virgo to split a jpa entities bundle in more bundles ?
For example there are 2 bundles jpa-bundle1 with Entity1 and jpa-bundle2 with Entity2
Entity2 has a reference field to Entity1. Both entities should be part of the same persistence unit.
Now i'd like to create an EntityManager in bundle-3 and pass it to other bundles (bundle 4,5 .. ) without explicitly import the jpa bundles in bundle-3
Any comments ?
Thank you
]]>attila Mising name2011-06-06T19:25:18-00:00Re: jpa entities in different bundles under virgo
https://www.eclipse.org/forums/index.php/mv/msg/210679/683347/#msg_683347
What you probably need to do is an extender bundle as bundle-3 (the one that publishes EntityManager). Once deployed such bundle will need to listen for bundle events and make a decision on when to publish EntityManager once all of the requirements for a complete persistence unit are met. This is fairly tricky as bundle can come and go at any time.
Can you please explain why you would not want to import jpa1 and jpa2 packages into bundle-3?
Another approach is to use virgo scoped deployment where entities referenced in the persistence.xml will be visible on TCCL.
Regards,
Dmitry]]>Dmitry Sklyut2011-06-13T15:01:17-00:00Re: jpa entities in different bundles under virgo
https://www.eclipse.org/forums/index.php/mv/msg/210679/685495/#msg_685495
the goal of this approach is something like this:
provider 1 creates base application with jpa-bundle 1
provider 2 creates extension for application with jpa-bundle 2
and the final user/customer presumably without much technical skills should be able to activate or not the extension.
Of course if there is an extension at model level is very likely to be also at the other layers (service, user-interface , etc) and then it can publish its own service/entityManager and notify the base application's extension points in a way or other. This works fine, i was just interested about other options.
The first idea i thought of was something similar to your event listener proposal and somehow i didn't feel very comfortable even to try it .
I don't see however what you mean with the second one , could you please give me a hint/link ?