Hey,

One of the key DDD concepts is that of a Repository, meaning, a place 
where you can get lookup existing entities either by id or by query. A 
Repository can also include methods for calculating numbers that are 
relevant to the collection as a whole, such as "Average salary of all 
Employees" in the case of a EmployeeRepository.

In Qi4j most such things are placed in the UnitOfWork, since that is 
always the "scope" of entities. If a client asks for a particular entity 
twice it will get the same if the same UoW is asked, and different if 
different UoW's are invoked. So, there is currently no framework support 
for Repositories.

One question is whether we should add this, and move over the 
find/get/query methods to it, or whether creating Repositories is 
strictly something that the domain developer does on his own, internally 
delegating to UoW's. One of the main problems with having a generic 
Repository is that we can't have domain-specific methods in it, such as 
the average salary outlined above. Same goes for queries, which will be 
more generic rather than specific. It might however be an option to have 
a base interface, and then allow extensions to it for domain specific 
methods.

I don't know what is best. Anyone have thoughts on this?

/Rickard


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to