-->
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: Should Entity directly talk to DAO
PostPosted: Fri Jan 27, 2012 4:33 pm 
Newbie

Joined: Fri Jan 27, 2012 4:24 pm
Posts: 1
I understand that from code clarity and manageability perspective it is better that my Entity class does NOT talk to it's DAO.

Now for this scenario (example):
Let us say I have a Car entity and car has CarType (which is also an entity).
When a new car is created Car entity needs to get it's CarType set on it as a member variable. So either the Service/BO/Manager (whatever we refer it) CarService class find CarType object and set on to Car object. Or just pass car type id in constructor or Car and let Car object pull CarType entity object from DAO and set onto itself.

What are recommended ways of doing it? Is there any other better way?

Thank you for thinking with me.


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.