-->
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: Primary key required in mapping file ?
PostPosted: Tue Jan 06, 2004 12:23 pm 
Beginner
Beginner

Joined: Tue Oct 07, 2003 12:11 pm
Posts: 32
Location: US
It seems that a primary key is required on every table that is mapped.

Not that every table has to have a primary key in the schema itself, but it seems to be required in the mapping file.

I need to have a mapping for a particular table without any primary key.
Any help would be much appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2004 12:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There allways should be a combination of properties which identify your row as unique. Map them as composite key. In the worst case, you need to map all columns as composite keys. If there are really duplicate rows in your table, you have a problem with your relational model anyways.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2004 3:53 pm 
Beginner
Beginner

Joined: Tue Oct 07, 2003 12:11 pm
Posts: 32
Location: US
Thanx for your suggestion.

But why do they force to have a pk even if i don't have one in the DB?

Should I consider this as a bug or a feature?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2004 3:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You might consider this a bug in your db, if there is a table without primary key :)


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.