This is a variation on the normal oneToMany mapping using two {@link JoinColumn} annotations instead of using the mappedBy
attribute.
In this mapping the position each child has in the parent's list is stored in the child table and fully managed by JPA. This means that this position index does not explicitly show up in the object model.
Example SQL DDL (h2 syntax)
create table Parent ( id bigint generated by default as identity, primary key (id) ); create table Child ( id bigint generated by default as identity, parent_id bigint, children_ORDER integer, primary key (id), foreign key (parent_id) references Parent );@author Arjan Tijms
|
|