-->
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 Surrogate key
PostPosted: Sat Oct 28, 2006 3:50 pm 
Regular
Regular

Joined: Thu Feb 24, 2005 2:34 pm
Posts: 80
Hi to all, i have question about business key.
I'm a little confuse about this concept. I have worked with old schema db always with composite id
Now i'm to going to develop a new software, and i will use hibernate 3. In this day i'm reading about persitence and surrogate key and i have some question to post you:
I take this simple class
Customer
pkid
cod_id
description
email
version (long or timestamp)

1) pkid is my surrogate key (native, sequence etc)
2) email is my business key

Ok now my question:
1) When i will use Hibernate saveOrUpdate, hibernate check my pkid for insert or update my record into database (dao.SaveOrUpdate(pojo))

Here i have difficult to understand how to do:
But if my business key is the email, i can't call SaveOrUpdate, is it correct?
Then i don't know the best approach for to check my bkey, I think into my dao class to implement this:
.....
check if exists this email into db with a simple hql or Criteria
and then to use SaveOrUpdate
....
Can you help me to understand how to use Business key with hibernate please. I have read Equals/HashCode but i have no idea when hibernate call this function
Thanks in advance for your help
Devis


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.