-->
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: how do I create a hbm.xml file with out any primary key
PostPosted: Mon Nov 17, 2003 5:57 pm 
Newbie

Joined: Mon Nov 17, 2003 5:52 pm
Posts: 2
Hi

I have a question my take has four fields


name
age
sex
address

different names used for easy understanding I have a bean created with setters and getters, I need to create a hbm.xml file for this, but my problem is that I have no primary key defined can I do anything this fancy.

The realtime table is used just to dump the data read and clean so that's the reason why no pk has been specified. Can anyone help me please?

Appreciate ur help..........)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 6:00 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A relational database requires a primary key to avoid duplicates and all the problems that come with them. Use a surrogate key.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: how do u make a surrogate key
PostPosted: Tue Nov 18, 2003 12:55 am 
Newbie

Joined: Mon Nov 17, 2003 5:52 pm
Posts: 2
Hi

this is a question to the previous forum don't think as dumb but trying to understand the concepts of hibernate so could you pls sgive me an examples of how it should look. that would help a lot.

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2003 12:59 am 
Senior
Senior

Joined: Tue Sep 23, 2003 8:18 am
Posts: 137
Location: Johannesburg, South Africa
Possibly make a complex-id using all 4 fields? IFF such a thing can be unique.

-G


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2003 10:35 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A surrogate key is not a concept of Hibernate, but of sound database design princicples. Search on Google.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.