Is there a way to define jpa entity classes outside of persistence.xml (i.e. in a separate file)?
Being able to not have persistence.xml as an external file would also suffice.
Thanks in advance,
Steven
Edit:
Sorry I was not clear. This is in a Java SE environment.
Also, I would like to not have a listing of some.class.AClass in my persistence.xml file.
This is because I would like to create this list of classes dynamically and reference a file containing this list.
Edit2:
Managed to solve this by writing a persistence.xml file at build time before it is packaged. If anyone is interested, I used scannotations to discover all the classes annotated with @Entity and wrote them to the persistence.xml file in target/classes/META-INF (using maven).
In a Java SE environment, portable applications must list classes explicitly in the
persistence.xml. From the JPA 1.0 specification:If portability is not a concern, some provider do support entity discovery in a Java SE environment (for example, EclipseLink, Hibernate).
If portability is a concern, using a third party container like Spring would help.