-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Examples related to composite primary keys
PostPosted: Wed Jul 19, 2006 12:08 am 
Newbie

Joined: Tue Jul 18, 2006 11:31 pm
Posts: 1
Location: Hyderabad
Hi,

I am new to Hibernate API. In our application, in most of the tables we have composite primary keys.

Hibernate version: 3.1

Can anybody send me the location of examples?.

Thanks in advance,
LALITH


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 19, 2006 1:33 am 
Regular
Regular

Joined: Sat Nov 06, 2004 5:20 pm
Posts: 54
Location: Collierville, TN
Here's an example:


Code:
public BUSINESSORGANIZATION getBusinessOrganization(Integer businessOrgPK) {
      BUSINESSORGANIZATION bOrg = null;
      List list =
         this.getHibernateTemplate().find
               ("from BUSINESSORGANIZATION bo where bo.id.BUS_ORG_PK = ?", businessOrgPK);
      if (null != list && list.size() > 0)
      {
         bOrg = (BUSINESSORGANIZATION)list.get(0);
      }
      return bOrg;
   }


The focal point is " where tableName.id.yourPK = ?...". I replaced my as400 tablename which was something like BHLKIKBO to class name BUSINESSORGANIZATION in the reveng.xml.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.