I would argue against putting finder methods in the generated entities, as I think it is a separate concern and you can easily end up with tightly coupled code which is difficult to refactor.
The "Rich Domain" model can end up becoming the "Blob" anti-pattern. I don't think stateful entities objects should be be mixed up with static finder methods. regards Malcolm Edgar On Wed, Mar 31, 2010 at 6:10 PM, Andrus Adamchik <and...@objectstyle.org> wrote: > Also I suspect I am not using a classic version of DAO. My DAO's are morphed > with the "business layer" and can have interactions with other subsystems, > not just Cayenne (e.g. caching, data access via web services, etc.). Also > they are not auto-generated, as any new methods are created when a need in > them arises in the application. The idea is to keep it tight and avoid > having any unused and unneeded methods. > > Andrus > > On Mar 31, 2010, at 10:02 AM, Andrus Adamchik wrote: > >> I am using a form of DAOs (with injection) with the main reason being that >> I can provide alternative implementations in a context-sensitive manner >> without changing the DAO interface (something that can't be done with the >> static methods), which is very handy in numerous situations. >> >> Andrus >> >> >> On Mar 30, 2010, at 11:51 PM, mgarg...@escholar.com wrote: >>> >>> When using Cayenne are DAO's still the pattern used for findAll, >>> findByProperty, and findById query methods or is there some better way to >>> do this in Cayenne? For example in the pet store project I see DAO's >>> being implemented, but I know that example was taken from other projects >>> that use DAO's to begin with so I'm not sure if it was just retrofitted >>> to >>> use DAO's with Cayenne. I tried to look at some other examples from the >>> website, but most of those are either not complex enough to warrant that >>> kind of structure or the links are dead. I hope this is clear. :) Also >>> if DAO's are the recommended pattern to use is there a tool (i.e. eclipse >>> plugin) that will generate them? >>> >>> Thanks. >>> -Mike >> >> > >