You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Franz Amador <fg...@yahoo.com> on 2008/01/21 20:26:27 UTC
T5: Inject services into domain objects?
Are there any plans for a way to inject services into domain objects, i.e. entities created by Hibernate? For example, my domain objects have some fairly complex business logic that must occasionally execute a query. For that, they use a DAO, which is a service, but it's not clear the best way for them to get access to the DAOs. In the absence of something better, I tend to keep a static reference to the instance of each DAO, but that's poor form.
Spring has a way of doing this using aspects, and I know it's controversial. I've seen heated debates between those who believe entities should be simple data carriers that have no reason to access services and those who prefer a more classic OO style in which the entities are full domain objects that carry out the primary behavior of the app. Obviously I fall into the latter camp, and I believe there are enough of us to form a sizable constituency for such a feature.
Re: T5: Inject services into domain objects?
Posted by Davor Hrg <hr...@gmail.com>.
have you tried using a hibernate interceptor ?
On Jan 21, 2008 8:26 PM, Franz Amador <fg...@yahoo.com> wrote:
> Are there any plans for a way to inject services into domain objects, i.e. entities created by Hibernate? For example, my domain objects have some fairly complex business logic that must occasionally execute a query. For that, they use a DAO, which is a service, but it's not clear the best way for them to get access to the DAOs. In the absence of something better, I tend to keep a static reference to the instance of each DAO, but that's poor form.
>
> Spring has a way of doing this using aspects, and I know it's controversial. I've seen heated debates between those who believe entities should be simple data carriers that have no reason to access services and those who prefer a more classic OO style in which the entities are full domain objects that carry out the primary behavior of the app. Obviously I fall into the latter camp, and I believe there are enough of us to form a sizable constituency for such a feature.
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org