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.


Reply via email to