I have two entity classes:
User.java
Address.java
One User can have many addresses (One to Many) And Many Addresses can belong to one user (Many to One)
User.java
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy="user")
private Set<Address> userAddresses = new HashSet<Address>();
Address.java
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="UserID")
private User user;
The problem is that although the values are inserted properly in both table, the foreign key column i.e UserID is not being updated. Can anyone please suggest what is wrong with the above snippet?