Cannot shorten OneToMany relationship

First of all, your use of orphanRemoval would mean that a Order should be deleted once removed from a set, so you should use orphanRemoval = false. Apart from that, you are specifying that the batchId join column is not-nullable, so why do you expect that it will be set to null then?