Hi to all,
I've a problem with runtime ClassLoader; this is my situation:
Have a Main project and other sub-projects, everyone with own persistence.xml; a custom ClassLoader load all classes from sub-projects' jars at runtime.
I need to create an EntityManagerFactory ("emf") for every jar loaded, specifing connection parameters, driver ... as ClassLoader set my customClassLoader. When an "emf" is created it has an internal "managedClassList" with entity names read in it's own persistence.xml.
But when create an EntityManager (emf.createEntityManager() or emf.createEntityManager(map)), this has no entities inside. I suppose it's a ClassLoader's problem, it's seems that my custom ClassLoader is not used and the entities that are in "managedClassList" will not be founded.
The problem doesn't exist if insert all sub-projects inside Main probject's libs, instead of load them at runtime.
How can I resolve my problem? Have to specify a particupar property to EntityManagerFactory?