Basic Design Question

View: New views
3 Messages — Rating Filter:   Alert me  

Basic Design Question

by RogerV :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does business logic have any place in an entity definition? - for example validation or should this always be done at a "higher" level?

Regards

Re: Basic Design Question

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would say yes, that is the point of having an object model.

But there are many different design patterns and philosophies, so this is just an opinion.

If you also define validation rules in the UI or the database, then there can be some redundancy, so you may choose just one place that works best for your application.

RogerV wrote:
Does business logic have any place in an entity definition? - for example validation or should this always be done at a "higher" level?

Regards

Re: Basic Design Question

by xcallejas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jueves 08 Octubre 2009 03:17:05 RogerV escribió:
> Does business logic have any place in an entity definition? - for example
> validation or should this always be done at a "higher" level?
>


I usually leave the entities as pure POJOs, but I also create a "controller"
java class for every jpa entity I must manage particulary.

I also use jpa entity heritance if need to do something special with this
entity.

This way, in my java web. apps, JSF is just my view component.

(my entity classes are in a separate package with the controllers of my jsf
web project).

rgds.
xavier.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users