On Nov 20, 2008 4:22pm, Jacek Laskowski <[EMAIL PROTECTED]> wrote: > On Wed, Nov 19, 2008 at 1:05 PM, Oliver Günther > wrote: > > Now I'm completely in the dark. How is could I possibly implement the > > following scenario > > > > bundle1: openejb-client > > bundle2: my-client > > bundle3: my-entity-classes > > > > Each bundle has its one class-loader, not seeing the classes of the > > other. How can I foresee this scenario and how to supply > > class-loading information via the OSGi-Manifest (I only know the Eclipse > > way via Bundle-Policies, which is actually the way I'm doing this) > > Require-Bundles or better Import-Package > >
This is a little more subtle than just that, Jacek. I believe Oliver means that the openejb-client code has no way of knowing which packages entity classes may come from. At least with the case of Hibernate, if your SessionFactory and Configuration are read in from a bundle that imports all the Hibernate packages, it cannot simply use reflection to load up org.example.myentities.Foo (as defined in the config file). The entity bundle can export all the packages, and my-client will import them, but if openejb-client has to instantiate them, it's a bit stuck. The only way I've seen to overcome this (outside of OSGi-platform specific hacks like Eclipse-BuddyPolicy) is to have the openejb-client API allow my-client to pass in a classloader at runtime when obtaining an EntityManager (or equivalent).
