-->
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: newbie: primary key
PostPosted: Tue Sep 13, 2005 6:42 pm 
Newbie

Joined: Tue Sep 13, 2005 6:35 pm
Posts: 2
Hi all,

I'm trying to use Hibernate with a table with no primary key. It does have a VARCHAR column which uniquely identifies each row, to use the cat example it looks something like this (of course I'm not dealing with cats):

unique_name varchar
age int
weight int
color varchar

the table is not used in any joins which is why it has no PK. Is there any way to tell Hibernate to use the unique_name varchar column as the ID field?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 8:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Sure - when you create the mapping for the table just define that column as the identity for the object.


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.