right now i was reading Compendium Spec 5.0 and hoped to find a solution about combining persistence bundles.
I would like to provided entities contained in different bundles by one EMF. For now it is not possible. All the entities have to be contained in the same bundle.
I am looking forward to install new bundles providing entities in runtime mode. They should join the "referenced" persistence context. I now that this would require a "pre bytecode weaving" so that all the entities are "ready" for its use in the persistence context and no restart of persistence bundle has to be performed.
A solution might be using fragments. But they do not provide its own lifecycle.
1) Is there a way using gemini propietary API to do this?
2) Are there any intentions by OSGi to provide a way? Maybe with the new subsystem specification?
We have plans in Gemini JPA to provide support for multiple bundles but it will not be as dynamic as you described. All of the bundles required for a given persistence unit will need to be available in order to start using the persistence unit.
If you want entities to be added dynamically then you might want to take a closer look at the EclipseLink dynamic entities feature:
I haven't tried using this with Gemini JPA, but I don't think there should be any problems since it is not a matter of classloading but is all runtime jiggery-pokery. Take a look and post whether it meets your need or not.
There are no plans for OSGi to extend the JPA spec to provide any such extended functionality.
I just remembered, you will want to use the dynamic entity API rather than the declarative virtual entities, so there is some classloading going on with the class generation, but at least you can pass in the "right" classloader.