-->
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: how to deal with the create issue in the rich domain model
PostPosted: Sun Sep 10, 2006 11:28 pm 
Newbie

Joined: Thu Aug 24, 2006 10:35 am
Posts: 2
hi, there,
I am reading the HIA and studying its codes now. In the Chapter8, the author tried to "squeeze" all the biz logic into domain model like in the BidForItemCommand

.......

ItemDAO itemDAO = DAOFactory.DEFAULT.getItemDAO();
UserDAO userDAO = DAOFactory.DEFAULT.getUserDAO();

MonetaryAmount newAmount =
new MonetaryAmount(bidAmount, (Currency)Currency.getInstance("usd"));
Bid currentMaxBid = itemDAO.getMaxBid(itemId);
Bid currentMinBid = itemDAO.getMinBid(itemId);

Item item = itemDAO.findById(itemId, true);
newBid = item.placeBid(userDAO.findById(userId, false),
newAmount,
currentMaxBid,
currentMinBid);

.........


Suppose we did not found a item from database and need to create a new one( Of course this will not happen in the CE), my quetsion
is where we should create the new item? In the biz logic , such as in the execute mothod , or within some domain model? In other words, it is whose reponsiblities to create a new object in such situations?

TIA.


OrNot


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.