Possible JpoxHelper bug; Custom PMFCreator not honoured [message #615513] |
Tue, 19 February 2008 09:52 |
Florian Hackenberger Messages: 123 Registered: July 2009 |
Senior Member |
|
|
Hi!
I'm trying to use Teneo with the standard JPOX plugin (copied to
eclipse/plugins) within an RCP application. According to [1] I need to
create the PersistenceManagerFactory like this:
//set classloader for driver (using classloader from the "rcp.jars" bundle)
ClassLoader clrDriver =
Platform.getBundle("rcp.jars").loadClass("org.h2.Driver").getClassLoader();
map.put("org.jpox.primaryClassLoader", clrDriver);
//set classloader for JPOX (using classloader from the "org.jpox" bundle)
ClassLoader clrJPOX =
Platform.getBundle("org.jpox").loadClass("org.jpox.PersistenceManagerFactoryImpl ").getClassLoader()
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(map,
clrJPOX);
Otherwise, the database driver cannot be loaded. With Teneo this procedure
should involve creating a custom PMFCreator and setting it via:
JpoxHelper.INSTANCE.setPMFCreator(pmfCreator);
This pmfCreator would then create the persistence manager factory in it's
method
getPersistenceManagerFactory()
like the code above. There is one problem however. JpoxDataStore on line 526
in createSchema(), doesn't use JpoxHelper to get a persistence manager
factory, but instead uses JDOHelper. Is that a bug? I'd say yes, because it
uses JpoxHelper in it's initialize() method. Is there a workaround
available? Placing the jpox plugin jar file within another plugin doesn't
work in my case, because I need the extension points which are registered
by the jpox plugin.
Cheers,
Florian
[1] http://www.jpox.org/servlet/wiki/pages/viewpage.action?pageI d=1179712
--
Florian Hackenberger
|
|
|
Powered by
FUDForum. Page generated in 0.01912 seconds