-->
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.  [ 5 posts ] 
Author Message
 Post subject: Tables with no primary key.
PostPosted: Tue May 24, 2005 5:06 pm 
Newbie

Joined: Wed Sep 03, 2003 11:30 pm
Posts: 5
Location: Minneapolis, Minnesota, USA
I am evaluating use of Hibernate on our existing database, and have several tables that do not have a unique index.

Are there any work-arounds/good practices for dealing with tables that do not have a unique index (other than, say, adding an identity column to the database)?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 6:47 pm 
Newbie

Joined: Fri May 20, 2005 12:39 pm
Posts: 10
If you are saying that there are no candidate keys meaning _no_ unique columns or set of columns (the table allows duplicate rows), then there is not much choice but to refactor your data design.

Otherwise the following doc might be what you are looking for...

http://www.hibernate.org/hib_docs/v3/re ... ompositeid


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 6:56 pm 
Newbie

Joined: Thu May 12, 2005 2:24 pm
Posts: 7
You should not have database tables without a unique key of some sort becasue there is no reliable way to tell them apart, update or query them.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 12:46 am 
Newbie

Joined: Mon Apr 04, 2005 6:01 am
Posts: 9
Location: INDIA
We had the same Situation in our Application.
You can put all the columns together as composite primary Key. This modification is only to the Hibernate Mapping file.

Try out a POC it will work well for you

Regards
RamnathN


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 4:10 am 
Newbie

Joined: Tue May 24, 2005 6:51 am
Posts: 5
How about just adding a surrogate key column to the table (a numeric sequence). It's far more convenient than composite keys.

Regards,
Stefan


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