You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Jean-Baptiste BRIAUD -- Novlog <j-...@novlog.com> on 2010/06/02 17:15:19 UTC

persistence.xml location

Hi,

I thought the persistent.xml file should be in the META-INF folder of .war file due to some JPA/JEE normalization but it I do not place it in the classes folder of my war file, it doesn't work.
Any idea or explanation ?

Thanks.


Re: persistence.xml location

Posted by Kevin Sutter <kw...@gmail.com>.
Hi Jean-Baptiste,
You are correct.  The persistence.xml file should in the META-INF folder of
the .war file.  Something along these lines...

emp.war
:
WEB-INF/classes/META-INF/persistence.xml
WEB-INF/classes/examples/model/Employee.class
:

This shows that the WEB-INF/classes is the persistence unit root.

Now, if your persistent entities are in a separate archive, then that jar
file should be placed in your WEB-INF/lib directory...

emp.war
:
WEB-INF/lib/emp-persistence.jar
META-INF/persistence.xml
examples/model/Employee.class
:
:

This should be working as advertised.  Of course, the app server being used
throws another variable into the mix since OpenJPA would require these
locations to be made available to our runtime to find the persistence.xml...

Just something to get you started...

Kevin


On Wed, Jun 2, 2010 at 10:15 AM, Jean-Baptiste BRIAUD -- Novlog <
j-b.briaud@novlog.com> wrote:

> Hi,
>
> I thought the persistent.xml file should be in the META-INF folder of .war
> file due to some JPA/JEE normalization but it I do not place it in the
> classes folder of my war file, it doesn't work.
> Any idea or explanation ?
>
> Thanks.
>
>