[hibernate-issues] [Hibernate-JIRA] Resolved: (EJB-295) mapping-file orm.xml not included

Emmanuel Bernard (JIRA) noreply at atlassian.com
Thu Mar 6 11:30:33 EST 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bernard resolved EJB-295.
----------------------------------

    Resolution: Won't Fix

You have the same file name (META-INF/orm.xml) twice in your classpath and you expect HEM to pick both of them.

This is not reliably possible as it would break all apps having more than one Persistence Unit. I recommand you rename your second file to META-INF/externalorm.xml for example.

> mapping-file orm.xml not included
> ---------------------------------
>
>                 Key: EJB-295
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-295
>             Project: Hibernate Entity Manager
>          Issue Type: Bug
>          Components: EntityManager
>         Environment: Hibernate Core 3.2.4.GA
> Hibernate EntityManager 3.3.1.GA
>            Reporter: Georges-Etienne Legendre
>            Priority: Minor
>             Fix For: 3.3.2.ga
>
>         Attachments: testcase.zip
>
>
> We have the following situation: A jar library for our entity classes has been created. In it, there are these two files in the META-INF directory: persistence.xml and orm.xml. We define some common queries in the orm.xml file.
> This library is then used in another project. Because we would like to define other more specialized named queries in this project, we assumed that another orm.xml file (in the META-INF directoty) could be used. Without any workaround, it doesn't work. The entity manager only find/use the orm.xml contained in the library. To make it works, we have to add these 2 lines in the persistence.xml :
> <mapping-file>/META-INF/orm.xml</mapping-file>
> <mapping-file>/META-INF/orm.xml</mapping-file>
> The entity manager then includes both orm.xml files.
> In JSR 220, chapter 6.2.1.6, it's said: "... A object/relational mapping XML file named orm.xml may be specified in the META-INF directory in the root of the persistence unit or in the META-INF directory of any jar file referenced by the persistence. xml. Alternatively, or in addition, other mapping files may be referenced by the mapping-file elements of the persistence-unit element, and may be present anywhere on the class path."

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list