Get the ID of a Child in a cascade="all" relationship, while adding it to a collection, in Hibernate
- by Marco
Hi,
i have two Entities, "Parent" and "Child", that are linked through a bidirectional one-to-many relationship with the cascade attribute set to "all".
When adding a Child object to the Parent children collection using the code below, i can't get the ID of the persisted child until i commit the transaction:
Parent p = (Parent)…