I am sure there must be thousands of examples demonstrating this connection, but I cannot find anywhere else.
I have a one-to-many relationship from a parent child and a one-to-one relationship from Child-Parent:
class Parent {
private Long id;
private String name;
private List<Child> children;
}
class Child {
private Long id;
private String name;
private Parent parent;
}
I expect that eventually 2 tables will appear that look like this:
Parent
- id : bigint
- name : varchar
Child
- id : bigint
- parent_id : bigint
- sequence : bigint
- name : varchar
Do I have a correct idea? If so, does anyone know what I need to put in the mapping file so that when the parent is deleted, they are also children.
Thanks in advance.
James
source
share