[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[pde-dev] Hibernate and Classloaders
|
Hi,
I have a problem regarding hibernate and plugin classloaders. I have a
plugin using hibernate, which loads hibernate.jar and all its
dependencies. I use this piece of code to add my files:
//Plugin: com.ed.a
Bundle b = PluginA.getDefault().getBundle();
Configuration cfg = new Configuration();
cfg.addProperties(props);
cfg.addURL(b.getResource("/aclass.hbm"));
cfg.buildSessionFactory();
This works because all my hbm files are in this plugin, and all mapped
classes as well.
Now, I have another plugin (PluginB), which should also use hibernate.
It depends on PluginA, but has its own hibernate hbm files and classes
(in its own classpath). When I use this code:
//Plugin: com.ed.b
Bundle b = PluginB.getDefault().getBundle();
Configuration cfg = new Configuration();
cfg.addProperties(props);
cfg.addURL(b.getResource("/bclass.hbm"));
cfg.buildSessionFactory();
this last line always gives a ClassNotFoundException for bclass.
Hibernate looks in its own classloader, but not in the classloader of
PluginB, where the needed classes are. This blog post gives some nice
input as well: http://www.ji.co.za/unplugged/?p=16.
I tried to implement this, but always got a ClassNotFoundException.
Could someone tell me in which manifest files I should use
Eclipse-RegisterBuddy and Eclipse-BuddyPolicy, and which values to
use?
Regards,
Leen Toelen