Home » Support » Forum » Feature suggestion: auto-detection of entities via persistence.xml extension

Feature suggestion: auto-detection of entities via persistence.xml extension


I am encountering problems (complexities) with EntityManager registration of entities across multiple modules in a multi-module Maven project. I have a  entities under many different paths in many different modules, and frequently evolving/changing.

JPA2 persistence.xml does not seem to have support for wildcards under the <class> field.

Apparently Hibernate has an autodetection extension system: hibernate.archive.autodetection


Example extension usage in persistence.xml:

    <!-- Scan for annotated classes and Hibernate mapping XML files -->
    <property name="hibernate.archive.autodetection" value="class, hbm"/>
    <property name="hibernate.hbm2ddl.auto" value="validate" />
    <property name="hibernate.show_sql" value="true" />

Q1: Would it be possible to introduce such an entity-scanning extension feature in ObjectDB ?

Q2: Does it make any difference to the EntityManager whether one performs compile-time enhancement or runtime enhancement ?

That is, does the enhancement have any effect on entities known to:

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au

Actually ObjectDB has an automatic mechanism for registration of entity classes, which should work unless exclude-unlisted-classes=true is specified in the persistence.xml file.

The classpath root that contains the persistence.xml file and any jar file specified with jar-file in the persistence.xml file (but not the entire classpath) are searched for annotated classes and XML data when you invoke:


It should work regardless if the classes are enhanced or not.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login