I have the following table to store structured free-form data:
Code:
ID GROUP_ID PARENT_ID TYPE VALUE
-------------------------------------------------------
1 1 null LIST null
2 1 1 RECORD null
3 1 2 TEXT bla
4 1 2 INTEGER 123
5 1 2 ...
The table is mapped to a hibernate class OrderData with fields:
List<OrderData> children;
OrderData parent;
using lazy="false" and cascade="all-delete-orphan". This works without problems but causes hibernate to send a lot of queries to validate that every children-List is initialized.
Is there a way to read the complete tree and initialize the parent/children properties using a simple query like "from OrderData where group.id = 1" (perhaps using the internal methods of the hibernate PersistentCollection classes) and keeping the cascade functionality?