JPA and ORM.XML not detected

Bug #585483 reported by rbadert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
Status tracked in 1.0
1.0
Fix Released
Medium
Unassigned
1.1
Fix Committed
Medium
Unassigned

Bug Description

My ORM file is contained in a separate jar file where all the business logic is stored. This package is imported as a library into my web project. Apparently it is not detected during startup as my named queries are not available.
In a persistence.xml file i have the property "mapping-file" to specify my ORM file.

I patched the JPAPlugin.java with the following code:

/** Support ORM file, rb 24.05.2010 */
String mappingFile = Play.configuration.getProperty("jpa.mapping-file", "");
if (mappingFile != null && mappingFile.length()>0) {
  cfg.addResource(mappingFile);
}

and add the following entry into "application.conf":
jpa.mapping-file=META-INF/orm.xml

then my orm.xml file will be detected by Hibernate.

Tags: jpa orm
Revision history for this message
rbadert (rbadertscher) wrote :
Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

Thanks, if I remember correctly orm.xml is the default name and you should not need it to specify it, correct? I will have a look at the JPA spec in any case.

Changed in play:
importance: Undecided → Medium
Revision history for this message
rbadert (rbadertscher) wrote :

Yeah that's correct - but you could give it another name and then you have to name it in the persistence.xml.
I added this, as Hibernate didn't recognize it in my Play application; probably because it is contained in a separate jar file which contains all the business logic. I even had to define jpa.entities=...., .... in the application.conf file to trigger the JPA entity manager. Looks like Play looks only into the model directory.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.