Last Updated: February 25, 2016
·
1.344K
· maroe

Dynamic Entities for EclipseLink

As EL misses the support for adding Entity-Classes programmatically, you can do the following:
Search your Classpath with the Reflections API (or Google Reflections API) for classes annotated with @Entity. Put these class-informations into your persistence.xml.
All other EL settings can be done programmatically via a properties map (new HashMap<String, Object>();) and a little help of PersistenceUnitProperties, which contains all available property-keys (never ever have a typo in your keys again :)