aspose file tools*
The moose likes Object Relational Mapping and the fly likes ORM MAPPING Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
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: 553
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: 553
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://aspose.com/file-tools
 
subject: ORM MAPPING