| 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.
|
 |
 |
|
|
subject: ORM MAPPING
|
|
|