Hello there,
I have a classloading problem using hibernate in an Eclipse plugin:
I developed a more or less generic hibernate based DAO,
which is working fine. Now I want to provide it's functionality
in an Eclipse RCP application within an own plugin called
"persistence-plugin".
I want to enable other plugins to use it's functionality with
their own entity classes not known by the "persistence-plugin".
Therefore I defined an extension point to publish the entity classes
to the "persistence-plugin", which can update the hibernate
configuration at loadtime and create a sessionfactory containing the
mapping of the entity classes of the "client-plugin".
Via the extension point mechanism I can get an instance of the entity
classes to provide them to the hibernate configuration, but they can't
be loaded by the classloaders from the "persistence-plugin" because
the plugins are separated in OSGI bundles and the "persistence-plugin"
doesn't know about any client plugin.
So if I try to access objects from the database, I get a
MappingException. I think it's because hibernate is unable to
instantiate the entity classes without having them available via
classloaders.
If I could provide an "object factory" or something like that,
I could store the instances gotten from the extensions and create
new objects via Class.newInstance()...
Does anyone have an idea how provide such an "object factory" to
hibernate, or how to solve this problem?
Also thought about a way to store the instances temporarily as class
files... :-)
Thanks a lot!
|