Updating oneToMany entity sets parent to null
问题 I have a list of Role entities on a User entity linked with a @OneToMany relationship. When I change the list on the User entity, i.e change the roles, hibernate removes the old roles and adds the new ones as desired. However the foreign key field is set to null on the Role entity. Can you explian why the foregign key field is null, and how would I change it so it gets picked up on an update? User.java @SerializedName("userrole") @Expose @OneToMany(mappedBy = "user", fetch = FetchType.EAGER,