I have this requirement to add entity classes to the persistence unit at runtime rather than specifying all of them in the persistence.xml. Can someone help me with the same?

I am aware that Hibernate has its own mechanism of doing the same using:

AnnotationConfiguration.addAnnotatedClass(Class), etc - You can also add hibernate config (*.hbm.xml) files programmatically.

The requirement is that without restarting the app server, I should be able to keep adding entity classes / their config (mapping) files to the persistence unit dynamically.

But the solution to programmatically add entity classes / configuration files at runtime to the persistence unit should not be specific to a JPA implementation.

Edit
Report