Beginner |
|
Joined: Tue Nov 18, 2003 12:34 am Posts: 39 Location: Dallas, Texas, US
|
Hello,
cascade in a many-to-one does not make sense to me.
I have cascade="all" for a many-to-one (as there is no explicit relationship from the other end). While creating the first child, Hibernate inserts the parent row and then the child row. While creating the second child, it seems Hibernate is doing an insert on the parent table with the same parent id causing errors. Given the definition of cascade, this behavior is expected, but this is not what I wanted.
I am just curious to know the motivation for a cascade option in the many-to-one relation. This insight will help me determine other options in designing my entities.
Thanks,
Madhan.
|
|