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
|