This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes ORM MAPPING Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "ORM MAPPING" Watch "ORM MAPPING" New topic
Author

ORM MAPPING

Shobha Korrapati
Greenhorn

Joined: Aug 08, 2007
Posts: 13
Hi All,

We are using JPA.

I have to build a native search query dynamically . I am using orm.xml for mapping.

Now ,i have to find some way to get the mapping details in ORM .That is, which field is maaped to which field in the table.

please help me out if any one knows any solution for this.

Thanks in advance
Shobha


SCJP , SCWCD
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 550
What JPA provider are you using? Most provide an API to access their meta-data.

Otherwise you could parse the orm.xml file yourself and determine the column names.


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Shobha Korrapati
Greenhorn

Joined: Aug 08, 2007
Posts: 13
Hi,

I am using Toplink.
If possible ,can you please provide me any information regarding how to read the metadata in toplink .

Thanks in advance,
Shobha
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 550
From the EntityManagerFactory, or the EntityManager (cast to TopLink interface in oracle.toplink.ejb.cmp3) you can get the TopLink Session (getServerSession or getSession). From the TopLink Session you can get the TopLink ClassDescriptor Session.getDescriptor(Class). The descriptor has API to get the table and field names, and mappings, (see oracle.toplink.descriptors, oracle.toplink.mappings).
Shobha Korrapati
Greenhorn

Joined: Aug 08, 2007
Posts: 13
Thanks a lot JAMES . Its working.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: ORM MAPPING
 
Similar Threads
Problem with matching field types in Sybase to Mapping file.
how to get a the data of the first row?
How to save Java Object to database
how to cast String to Clob ?
Using solr with java best practices