Issue Details (XML | Word | Printable)

Key: NUCJPA-247
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Peter Kriens
Votes: 0
Watchers: 1
Operations

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

JPA Transformer uses brand new context in managed mode.

Created: 03/Sep/13 06:00 PM   Updated: 23/Oct/13 11:55 AM   Resolved: 09/Oct/13 08:13 PM
Component/s: None
Affects Version/s: 3.3.0.release
Fix Version/s: 3.3.3

Environment: OSGi (core=3.2.5, api.jdo=3.2.4)

Datastore: MySQL
Severity: Development


 Description  « Hide
I am running Datanucleus in an OSGi environment, creating an EMF from a PersistenceUnitInfo. I set the following properties:

properties.put("datanucleus.jpa.addClassTransformer", "true");
properties.put("datanucleus.plugin.pluginRegistryClassName",
"org.datanucleus.plugin.OSGiPluginRegistry");
return pp.createContainerEntityManagerFactory(info, properties);

This registers a org.datanucleus.api.jpa.JPAClassTransformer instance with the PersistencUnit. However, when a class is now transformed, this instance initializes the DatanucleusContext without any properties. It therefore will not create an OSGiPluginRegistry and hence fails miserably since it completely messes up class loading.

9/3/13 5:52:33 PM (I) PersistenceConfiguration.setProperty : Property location unknown - will be ignored
9/3/13 5:52:33 PM (I) PersistenceConfiguration.setProperty : Property hibernate.transaction.manager_lookup_class unknown - will be ignored
9/3/13 5:52:33 PM (I) PersistenceConfiguration.setProperty : Property openjpa.jdbc.synchronizemappings unknown - will be ignored
transforming [org.datanucleus.api.jpa.JPAClassTransformer@2712ee9] org.apache.felix.framework.WovenClassImpl@4471dfd7
9/3/13 5:53:09 PM (W) NonManagedPluginRegistry.getManifestURL : Could not find MANIFEST.MF file for plugin file "bundle://31.0:1/plugin.xml" so ignoring it
9/3/13 5:53:09 PM (W) NonManagedPluginRegistry.getManifestURL : Could not find MANIFEST.MF file for plugin file "bundle://31.0:1/plugin.xml" so ignoring it

Looking at your code, it seems that the JPAClassTransformer should get the context from the EMF since it must have access to the metadata as well. I can;t imagine this code is working somewhere?


Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 09/Oct/13 07:49 PM
1. Doesn't affect non-managed mode.
2. Not as simple as just using NucleusContext from EMF since a NucleusContext is (currently) for a particular mode of operation ... persistence or enhancement. Those two modes handle metadata differently. One way would be to take the properties from the EMF (NucleusContext) and apply those to the enhancing NucleusContext that is created in RuntimeEnhancer

Andy Jefferson added a comment - 09/Oct/13 08:13 PM
SVN trunk (core, api.jpa) pass in overriding properties for EMF (managed mode only) to the transformer. Left to issue raiser to test, and confirm.

Andy Jefferson added a comment - 23/Oct/13 11:55 AM
Assumed to work though untested and no comment to the contrary.