I need to upload addresses for a user. User has two addresses , address and postal address, if these addresses are different to each other it is easy I will save both addresses but how to keep the ids the same if the addresses are the same ?
User class
private Address address;
private Address postalAddress;
....
Code
....
session.save(user.getAddress());
session.save(user.getPostalAddress());
.....
What to do if both addresses are the same?