tags:

views:

81

answers:

1

Hi all

If I have an entity with a parent / child relationship (and Cascade=CascadeType.ALL), and call:

getSession().save(parent)

the primary key of the parent is returned.

Is there a way to access the primary key of the created child?

Regards

Marty

+3  A: 

The object itself should have it. If not, try calling Session.flush() first.

Rob H
Ah yes. That ol' most obvious solution...
Marty Pitt