The HibernateBundleActivator registers itself as a BundleListener. The prototype currently provides a custom ClassLoader that iterates through all ACTIVE Bundles until a class or resource is located, each time its requested. This is terrible for obvious reasons.
Instead, we're discussing alternatives and improvements:
1. Request that users mark specific Bundles as "interesting to Hibernate". This could simply be an additional value in the manifest, an additional META-INF file, etc. Only Bundles housing mapping resources, entities, Services, Integrators, Types, UserTypes, etc. would be designated with the marking. Hibernate would then only need to maintain references to the Bundles it "cares" about.
2. Cache references to all Classes and Resources discovered in all ACTIVE Bundles. This has obvious memory concerns, but would provide the best performance.
3. Cache references to Classes and Resources as they are discovered for the first time. This also has memory and performance considerations.