How Common to Spring Manage Beans Created By Hibernate?
Hello,
We've heard time and time again to "put business logic inside your business objects". Most of the time, full business logic requires dependencies to be injected in my business object. The business objects themselves (Business, Account, etc) are managed by Hibernate. Their dependencies are/should be managed by Spring.
How common is this? If my business object is something that comes from the database, but requires external dependencies, then Spring must create and wire up my object.
This seems fair and good, but I haven't seen many examples of this usage. It makes me wonder if my business domain objects (those that come from the database) should ever rely on external dependencies.
My gut says yes: keep business logic in business object. Note: this does not mean DAO type actions.
Of course, I could keep the business objects free from external dependencies, but then their ability to do work is greatly lessened.
Thoughts? Comments? War stories?
Thanks very much!
Seth