|
Hi,
Is there is any plans to support 1-m unidirectional associations in near future? I know that it’s supported in some cases, but in some not - example - when Child have not null FK to the parent. Biggest problem is that in object model only parent has knowledge about children but in database model child has FK to the parent (part of child state) – object model and relational model mismatch. I know that some O/R tools trying to solve this problem by declaring parent FK holder in the Child state but it sucks.
I looked briefly at source code and I think right now it’s difficult:
1) State loaded from database and stored in session cache = Object state in user land – so if I’m not declaring FK property in the child object or many-to-one association it will be never updated. 2) Cascades processing code for 1-m iterates through collection and delegates creation or update (saveOrUpdate) for each collection member to the session. So from session point of view there is no way to know in what context that child is created or updated by context I mean is it a part of or contained by a parent. 3) I believe it would be much better to operate inside hibernate session with “user land object state holders” rather than directly with user objects – because in this case it’s will be possible to have more information inside state holder (example parent FK).
Actually JDO uses this kind of approach: User land object <-> State Manager <-> Actual object state from database
PS: Hibernate is excellent well designed O/R framework and we are successfully using it in huge mortgage insurance project which has around 200-300 domain classes.
Best regards,
Giedrius
|
