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). I specify @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<>(); because
- 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 hibernate-update-OrderColumn.zip |