Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ORM MAPPING

 
Shobha Korrapati
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shobha Korrapati
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot JAMES . Its working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic