Hello, All!
I am use Spring IoC and find it very useful for the entire application needs (like resource management, security, transactions and maybe others cross-cutting concernsin the future). Dao object resides in the IoC container. I would like to that my domain objects resides as prototypes in the IoC container too, therefore I can configure it easy (espessially for declarative transactions and security). May I done it using Hibernate? i. e. let the hibernate instantiate it as I wish, not using empty constructor.
Another thing I intend to do is using Dao objects in my domain objects methods.
I know that HIA suggests to avoid such things. But I cant't find another approach to organize my domain objects. The reason is simple:
1. some of the business methods represents coarse grain use cases
2. therefore business methods should modifing objects and create new ones
3. business methods should be polymorphic, therefore I can't move such methods in some kind of the Service layer's objects
Any comments and critique wold be appreciated.
Thanks.
|