205 words

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

2017-07-04 04:05

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
webel's picture
Joined on 2011-05-27
User Post #132
2017-07-05 17:26

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)
support's picture
Joined on 2010-05-03
User Post #2,770

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Maximum file size: 32 MB