Consider class Parent:
{
...
@OneToMany(cascade=CascadeType.ALL,mappedBy = "parent")
Set<Child> children;
...
}
And class Child:
{
...
@ManyToOne
@JoinColumn(name="parentID")
Parent parent;
...
}
If I create a new child inside of the application and put it inside the children field of the Parent, and then persist the Parent object, why doesn't Hibernate automatically update the parent field (in order to set the parentID column) of the Child object?