-->
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.  [ 1 post ] 
Author Message
 Post subject: business key as/vs primary key
PostPosted: Tue Mar 03, 2015 8:55 am 
Newbie

Joined: Tue Mar 03, 2015 4:35 am
Posts: 1
we have legacy code where we have unique identifiers as artificial business keys in all our model classes.
we do use this property in the #equals() and #hashCode() implementation of those model classes to determine equality/uniqueness of the instances.
also we make sure upon instantiation of a model class, that this ID (business key) property is initialized right then, so that it is never null and always a valid, immutable value.

now - with migrating to Hibernate, we wonder whether there are any hard reasons why it would be disadvantageous to re-use this unique business-key identifier as the primary key (aka @Id) for Hibernate ?
- or would it be recommend (and why) to add an extra property as/for the artificial/surrogate primary key to each such model class?


secondary: any good reason, apart from readability, speaking against an UUID as such PK ?

thanks in advance - matthias


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.