So, I have a onetomany relationship between two classes called Customer and Address.
In the Customer class I have: @OneToMany(mappedBy="customer", cascade = CascadeType.ALL) private Set addresses;
And in Address I have: @ManyToOne(optional=false) private Customer customer;
Now, when I try to create a new customer with its address everything works just fine, but in the Addresses table on my database, the column customer_id is null and I don t know why. I thought CascadeType.ALL would ve done all of this linking job. I ve also tried adding a JoinColumn on the relationship on the Address side, but that didn t work either. What should I do? I hope I ve been clear enough.