-->
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: Load(Classname, id)
PostPosted: Thu Jun 14, 2007 11:41 am 
Newbie

Joined: Tue Jun 12, 2007 6:44 am
Posts: 13
Location: Brazil
Hi everyone.

I have a table named customer and its primary key is composite.
I need to load an object from this table so I provide the Classname and a valid id.
Example: session.load(Customer.class, new Long(1));

This example above works fine if you have a simple primary key.

In my case it is a composite PK. How can I load such object.


Thanks in advance!!!


Top
 Profile  
 
 Post subject: Composite key load
PostPosted: Thu Jun 14, 2007 12:15 pm 
Beginner
Beginner

Joined: Thu Jan 13, 2005 10:50 am
Posts: 30
Location: Minneapolis, MN
Suppose Student class and table are having composite key as name and age
do something like this

Student stud1 = new Student();
stud1.setName("paras");
stud1.setAge("12");

session.load(Student.class, stud1)

_________________
** Rate me if the solution was useful **

Regards,
Paras Jain


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.