I am trying to use EclipseLink in OSGi environment.
What I want to do is, building a provider bundle that exposes EntityManager to other bundles.
The problem is, entity classes can not be determined and written to persistence.xml file at compile time. So I want to be able to define entity classes programmatically. I can scan for all Entity classes, but as far as I could see, there is no way to define it in EclipseLink, while it is possible in Hibernate. (Hibernate has some different issues in OSGi environment, so I can not use it either)
How can I define entity classes programmatically ?
Note: Using spring is not an option for me; and defining ClassDescriptors from scratch is not acceptible. I must say that it is really stupid that such an essential feature is not supported neither in JPA nor EclipseLink directly.