Hibernate version: 3.2.4.sp1
Despite (or... in consequence of..) an accurate reading of on line documentation, the book of Christian Bauer and Gavin King (2nd edition) and a long long search in the forum, i can say that..
I've nothing understood. I'm in total confusion.
I have to implement a large number of parent-child structures in a web application.
I need the long-conversation approach, so I can work with parent and child editing (and add and remove childs, of course); so:
- FlushMode.MANUAL
- one Session at the beginning of the work (the time of parent loading or creation)
- session disconnection/reconnection for the "user think time"
and so on.
In this scenario I cannot figure out other way to manage a child collection than as a List (ArrayList):
I need to manage childs that are created and that lives only in memory until the final persist, and so I NEED an index to pick and edit them because the surrogate key is not present before that time (no: I have not sequence in db) and I have no other handle than the index of the child in the collection.
Sometimes parent and childs are legacy tables with composite id.
I have to add that I need a reference to parent in the child.
So. Some questions:
1) I've often red in the forum that lists are not a good structure, but how can I handle a similar situation without lists? I think that this is a quite common need, and any suggestion will be greatly appreciated.
2) Index property getter/setter in the child: who have to manage it? There was a workaround (
http://www.hibernate.org/193.html) for it, but this was for Hibernate 2. Is it still valid for Hibernate 3 or I must expect disasters in using it? (At the moment some structures are mapped in this way and it seems that they work correctly, but...).
Is there a standard correct approach of definefor Hibernate 3?
Thank you very much