DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCJPA-87
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Ioannis Canellos
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus API JPA

JPA OSGi Bundle should be usable via the OSGi enterprise blueprint.

Created: 18/Nov/10 01:41 AM   Updated: 08/Dec/10 03:28 PM   Resolved: 18/Nov/10 09:14 AM
Component/s: None
Affects Version/s: 2.1.3
Fix Version/s: 2.1.4

File Attachments: 1. Text File NUCJPA-87-patch.txt (2 kB)

 Description  « Hide
org.datanucleus.PersistenceProviderImpl should be registered in the OSGi service registry as described by the OSGi JPA service spec.

Ioannis Canellos added a comment - 18/Nov/10 01:46 AM
Attaching a patch which adds a blueprint.xml file under OSGI-INF, that create a service of the interface javax.persisistence.spi.PersistenceProvider.

Ioannis Canellos made changes - 18/Nov/10 01:46 AM
Field Original Value New Value
Attachment NUCJPA-87-patch.txt [ 11311 ]
Andy Jefferson added a comment - 18/Nov/10 09:14 AM
Patch applied, thx. Perhaps you can contribute some simple documentation on the "OSGi JPA service spec" ? even if just a few lines. Add it here as a comment and I'll add to the main docs.

Andy Jefferson made changes - 18/Nov/10 09:14 AM
Status Open [ 1 ] Resolved [ 5 ]
Assignee Andy Jefferson [ andy ]
Fix Version/s 2.1.4 [ 11073 ]
Resolution Fixed [ 1 ]
Ioannis Canellos added a comment - 18/Nov/10 10:01 AM
In a non OSGi world the persitence provider implementation is loaded using the service provider pattern. The full qualified name of the implementation is stored in a file under META-INF/services/javax.persistence.spi.PersistenceProvider (inside the jar of the implementation) and each time the persistence provider is required it gets loaded with a Class.forName using the the name of the implementing class found inside the META-INF/services/javax.persistence.spi.PersistenceProvider.

In the OSGi world that doesn't work. The bundle that needs to load the persistence provider implementation cannot load META-INF/services/javax.persistence.spi.PersistenceProvider.

A work around is to copy that file inside each bundle that requires access to the peristence provider.

An other work around is to export the persistence provider as OSGi service.

Here is a link that explains things better than me:

Ioannis Canellos added a comment - 19/Nov/10 08:53 AM
I think that the patch I supplied breaks the pom.xml file. Please let me know if you wish me to resend an updated patch.

Andy Jefferson added a comment - 19/Nov/10 08:57 AM
The patch had a missing </...> yes, but i spotted it when my XML editor complained ;-). SVN trunk should be fine

Andy Jefferson made changes - 08/Dec/10 03:28 PM
Status Resolved [ 5 ] Closed [ 6 ]