-->
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: Tranparent Persistence Clarification
PostPosted: Fri Jun 17, 2005 5:15 pm 
Newbie

Joined: Thu Jun 02, 2005 3:25 pm
Posts: 7
Location: Traverse City, MI
I am developing a system with the Spring Framework and Hibernate and I am using the DAO Pattern to abstract my data access code. Something that seems odd to me is the transparent persistance mechanism of hibernate. It seems to be making my DAO obsolete on edits. Here is what I mean:

Code:
ClientDAO dao = new DefaultClientDAO() ;

Client client = dao.getClientFromId(1) ;

client.setName("New Name") ;

// this call doesn't appear to be necessary
dao.store(client) ;


The above code poses a problem if the name that is set is invalid. Let say I have a ClientValidator object that makes sure the edits to the client object meet the system requirements, it would be to late at this point because the value would be stored to the db before the validator even gets to it.

Any suggestions on a solution? Or if I am way off on how things work with Hibernate please give me some direction.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 7:09 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Rollback if there is a business error.

_________________
Emmanuel


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.