-->
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: Hibernate design best practices
PostPosted: Tue May 26, 2009 5:53 pm 
Newbie

Joined: Tue May 26, 2009 5:10 pm
Posts: 4
Hi,

I am a newbie and have a question about best practices for design. From what I understood so far, it seems the domain model objects should be POJOs. DAO layer is used to encapsulate persistence. EntityManager layer provides a facade for application controller to interact with model.
But I can't seem to find any satisfactory answer to whether domain model objects should contain any business logic or helper methods in them.
Say, for example, a model object has an attribute priority, and depending on the value, the object's priority is categorized to low, medium, high. A helper method would return appropriate category depending on the attribute value. Where should such logic be placed? The domain model object seems like the convenient place for it. What are the pros and cons of using such approach? Where should one draw the line of putting too much business logic in POJOs.

Any help will be appreciated.

Regards,
-jas


Top
 Profile  
 
 Post subject: Re: Hibernate design best practices
PostPosted: Fri May 20, 2011 10:17 am 
Newbie

Joined: Tue Nov 30, 2010 5:57 am
Posts: 5
The simple answer is that if that behaviour is intrinsic to the object, it should be in the object. If the behaviour is down to how the business operates, it should be in the service tier.

The motivation is that the innate nature of things don't change, but business rules do.


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.