I have the following table structure:

```
parent(parentId)
child(childId, parentId fk)

```

Then, I have the following objects:

```
@Entity
@Table(name = "parent")
public class Parent {
   @Id
   @GeneratedValue(...)
   private String id;

   @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
   @JoinColumn(name = "parentId")
   Set<Child> children
}

@Entity
@Table(name = "child")
public class Child {
   @Id
   @GeneratedValue(...)
   private String id;

   @Column(...)
   private String parentId;

}

```

Now, I create a transient parent and child, and I add the child to the parent, then save the parent:

```
Parent parent = new Parent();
parent.children.add(new Child());

parentDao.save(parent);

```

I get the exception:

```
org.hibernate.PropertyValueException: not-null property references a null or transient value

```

**My question:** How can I get the parentId in the child class to automatically be set to the value generated by the insertion of the parent?