I have a JavaEE project with several entities with the following persistence.xml
file:
...
<properties>
<!-- Scan for annotated classes -->
<property name="hibernate.archive.autodetection" value="class"/>
...
And it seems to work. The project is then deployed as a JAR to two different projects. In one them, the persistence.xml
file is basically the same as the one above, i.e. uses the autodetection
feature of Hibernate. However, it does not seem to work (because I think it needs to load search for the entities in a jar). When I tried manually listing all the entities in both xml files, everything works correctly.
Edit: It works with jar-file but only with the absolute path to the jar. Pretty useless for a team project.