I dunno if i'm doing the correct thing, but I have objects that have both persistent data and dependency to other objects, where Hibernate manages the persistence of the data and spring manages the dependencies.
The problem is, when hibernate creates an object it will simply call its constructor and initialize it, instead of letting spring somehow manage the dependencis before using it, So the objects returned by hibernate will have incorrect or null dependencies. I know some patterns to overcome this using factory methods or adapter objects, but :
1 - Is this way of combinig Spring's Dependency Injection & Hibernate's Persistence correct ?
2 - Is it good or bad to have such objects, containing both data & dependency ?
3 - Is their anyway to tell hibernate to get its objects from spring's application context instead of creating it ?
Thanx ..
---------------------------------------------------------------------


Reply With Quote