-->
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: Where should the duplication checking routine take place ?
PostPosted: Wed Jul 19, 2006 12:09 am 
Beginner
Beginner

Joined: Wed Aug 25, 2004 10:27 pm
Posts: 21
Location: Indonesia
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hi all,

I've just read HIA, after finishing Chapter 8. (Writing Hibernate Applications) I have a question here.

Before persisting a domain model to DB I need to make sure that the record does not exist yet in the database by comparing ID from domain model to the one in DB.

That is, I need to query the DB first using the ID contained in the domain model and if the query returns 1 record that means the record already exists in the DB and the domain model should not be persisted.

I don't know where the above routine should take place, I definitely can not put it in the domain model itself since this will pollute the domain model with persistence API and DAOs.


Regards,


Setya


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 19, 2006 3:41 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Go to the regular User forum.


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.