This conversation sounds like the "Anemic Domain Model vs. Rich Domain Model" argument where an ADM only contains data and a RDM contains data and services. I have always used an ADM and like Thiago, I sometimes add functions that do not require a database connection. I have never really understood how to inject the session into an RDM without using a factory pattern. I once read that someone was able to intercept the constructor for domain objects and inject the session so that a factory pattern was not required but I can't seem to find the link for that. It sounded a bit too magic to me and when it comes to code, I hate magic ;)
Here's some further reading: http://www.substanceofcode.com/2007/01/17/from-anemic-to-rich-domain-model/ http://codeflow.blogspot.co.uk/2007/05/anemic-vs-rich-domain-models.html http://vitamic.wordpress.com/2007/01/04/anemic-domain-model-illustrated/ -- View this message in context: http://tapestry.1045711.n5.nabble.com/Injecting-Session-into-DAO-tp5713703p5713725.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org