With a simple Parent -> Child relationship, with an ordered OneToMany (List).
No updates are made to the @OrderColumn if updatable = false is specified on the @JoinColumn and changes are made to the List (e.g. order change, or removal from middle of the list).
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "parent_id", nullable = false, updatable = false)
@OrderColumn(name = "child_index", nullable = false)
private List<Child> children = new ArrayList<>();
The child's lifecycle is linked to the parent
The parent should never update
I want to avoid unnecessary update Child set parent_id=?, child_index=? where id=? on inserts
But it seems it is affecting the update of the OrderColumn
Here is the test-case
Hibernate 5.4.0.Final, jdk1.8.0_45, windows, using H2 db