-->
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.  [ 4 posts ] 
Author Message
 Post subject: Little challenging question
PostPosted: Fri Sep 28, 2007 7:58 pm 
Newbie

Joined: Fri Sep 28, 2007 7:40 pm
Posts: 9
*) I have a TABLE with columns A, B & C.
*) A, B & C together form the composite primary key

Query Criteria: I would like to retrieve the different values of C for a given A & B

Below is the procedure that I followed:
http://www.theserverside.com/discussion ... d_id=22638

to create and query the table

Question:
1. As A, B & C form composite key, Hibernate is not allowing me to create the composite key with Just A & B. If I query that way I am getting only one instance. Is there is a way to query for the above criteria

OR

2. Is it possible to avoid the <id> tag some how

Your expert advice is much appreciated.

Thanks,
Venkat


Top
 Profile  
 
 Post subject: for composite PK
PostPosted: Fri Sep 28, 2007 10:17 pm 
Newbie

Joined: Thu Aug 30, 2007 1:05 pm
Posts: 7
Location: Bangalore
u have to provide all the column values otherwise it will not tAKE,why bcoz pk is not null.ok
instaed of that
u take another column asID which is auto generated number,
which is alredy provided by the hibernate.

_________________
Kumar Phani


Top
 Profile  
 
 Post subject: for composite PK
PostPosted: Fri Sep 28, 2007 10:18 pm 
Newbie

Joined: Thu Aug 30, 2007 1:05 pm
Posts: 7
Location: Bangalore
u have to provide all the column values otherwise it will not tAKE,why bcoz pk is not null.ok
instaed of that
u take another column asID which is auto generated number,
which is alredy provided by the hibernate.

_________________
Kumar Phani


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 29, 2007 4:45 pm 
Newbie

Joined: Fri Sep 28, 2007 7:40 pm
Posts: 9
Kumar,

Thanks for the response.

As mentioned the table has only 3 columns, so I don't have a choice there.

Can you please provide me more insight on the Hibernate generated id i.e sample code/XML configuration file syntax.

Thanks,
Venkat


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.