-->
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: Suggested way to maintain business rules in Hibernate
PostPosted: Thu Feb 10, 2005 4:14 pm 
Newbie

Joined: Thu Feb 10, 2005 4:01 pm
Posts: 1
Location: Seattle, WA
I'm porting a legacy application which impemented a fairly simple header/detail parent child relationship. I'm also using the DAO architecture as suggested in the "In Action" book. The parent object contained a persistent running total of the quantity and amount totals of all the children. In the old application, the setQuantity() and setAmount() of the child called an update() method in the parent to update the totals on the fly.

I'm unsure how to do this in Hibernate. Since the setters are called often by reflection in object initialization, it's less clear to me how to keep the totals updated. I realize I can implement an interceptor that will update the totals when the object is saved, but in looking at the sample interceptor code, it doesn't look like it's meant to update objects other then itself in the interceptor. I also have the case of business rules which may or may not allow upates to the child object based on different attribute settings (e.g. an order that has been processed may not have its quantity changed. How are these types of business rules typically implemented in Hibernate. I know they must be pretty common mechanisms.

I'm using Hibernate 2.1.7, JDK 1.4.2 with Oracle 9.2.0.5


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.