-->
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: Business Objects and State [Core J2EE 2nd Ed]
PostPosted: Tue Feb 10, 2004 11:48 am 
Newbie

Joined: Tue Nov 25, 2003 4:31 pm
Posts: 12
Location: Minnesota
I recently finished a project where our Domain objects were in charge of managing persistence and behavior (if someone changes a shipping address, recalculate their warehouse based on an account). This requires calls back to the persistence layer via a Home-type service.

The new Core J2EE patterns book suggests Business Objects that wrap simple state objects:

Code:
public class CompanyBO
{
     protected CompanyData companyData;

     public CompanyBO(CompanyData _companyData)
     {
         // validate data
         this.companyData = _companyData;
     }

     public ContactBO getContact()
     {
          return new ContactBO(companyData.getContactData());
     }
}


So we split our application into Business Objects and Data Objects where the Business Objects operate upon the Data Objects. So now from the application layer, we can talk to the data model and grab lightweight objects, or if we need to do complex business operations, we take the data and wrap it in a business object. Business Objects would pass their data objects by copy.

Example: List all Orders with light weight Order data objects to save processing, then once an order is selected by ID, ask the data model for a full OrderData object and wrap it with an OrderBO to actually do your operations with (OrderBO would take care of recalculating the warehouse if the shipto changes, etc).

But what would be the proper way to have OrderBO objects communicate that some data needs to persisted?

Any suggestions would be super helpful in such a case of "changing a shipto in order to recalculate the warehouse based on x-variables".

Many Thanks!
Jacob


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2004 1:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The Hibernate "best" approch is not to use such wrappers.

I think you'll have to manually copy data from your BO to your Data objects.

_________________
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.