-->
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: is id necessary for every table
PostPosted: Tue Nov 22, 2005 5:39 am 
Newbie

Joined: Fri Apr 01, 2005 2:15 am
Posts: 14
Hi all,
Is it necessary to have id column in every table having generator class
as" increment","uuid.hex" etc.Doing in this way we are adding an extra column in the table.

But if we use generator class as "assigned" then we can make a column of the table as primary key.So in this case there is no extra column is getting added.

I want to know wheather second approach is correct or not?Does it have any
limitation?

with regards,
ajse


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 5:49 am 
Regular
Regular

Joined: Wed Feb 02, 2005 6:33 am
Posts: 70
The second style you mention, is basically using a business key as the id, correct?

This is discouraged because at design time, although you may believe a key to be both unique and unchangeable, business requirements change. For example, a naive implementation might use a company's name as the id for a company. If that company merges with another, the id becomes invalid, and the system's integrity is compromised.

Using an internal id will not take up that much space, esp. if you use a generator like the 'native' generator that uses numbers instead of strings. It means that your business entities can change as required to match the evolving design.

I believe that there are a number of other posts asking this question, more information is available with a little searching.


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.