Is there any clean way to get the id of a child object, when the parent has been merged?
I.e.
Parent parent = parentDao.get(parentid);
Child child = new Child();
parent.addChild(child);
parentDao.merge(parent);
child.getId() // is null
I have a many to one relationship between the parent and the child.
Another question asked this, and the only solution that worked was to traverse the list of children, but that sounds horrible and hacky.
JPA How can I get the generated id/object when using merge from parent but child is created?
Surely there must be a nicer solution to this.