This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes JPA EclipseLink orm.xml and persistence.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA EclipseLink orm.xml and persistence.xml" Watch "JPA EclipseLink orm.xml and persistence.xml" New topic

JPA EclipseLink orm.xml and persistence.xml

Udayan Kumar
Ranch Hand

Joined: Jan 16, 2007
Posts: 66

I am new to JPA and using Toplink (Oracle's distribution of the open-source EclipseLink) with JPA annotations . I am a bit confused with the purpose of the orm.xml and persistence.xml.

All the JPA based java classes (representative of each underlying database table) should be cataloged in the orm.xml file or persistence.xml file.

I have seen examples on the internet which have entries sometimes in the orm file and sometimes in the persistence file.

Let me know.

James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
The orm.xml file is an option to use to map your entities instead of using annotations, if you are using annotations then you do not need it.

The persistence.xml should technically list all of the persistent classes using the <class> tag, but if all of your classes are in the same jar file as your persistence.xml, then these will be discovered by default in JEE,
and in JSE if you set <exclude-unlisted-classes>false</exclude-unlisted-classes>.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Have you checked out Aspose?
subject: JPA EclipseLink orm.xml and persistence.xml
jQuery in Action, 3rd edition