Can I use multiple orm.xml files in JPA on JBoss EAP?

Solution In Progress - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Issue

Can I specify for than 1 orm.xml in my persistence.xml? for example?

META-INF/orm.xml
META-INF/orm2.xml
META-INF/orm3.xml

if so, will it merge the all 3 configurations?
The reason is that I am not always packaging all entities so I a need a flexible way and I must use orm.xml right now to override annotations because I need to override the annotations for the @ID for each entity.

Resolution

Yes, JPA supports multiple orm.xml files. They will be combined, however multiple configurations for the same Class will cause problems.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.