I have two entities User and Contact . User object contains the Contact. How do I use JPA annotations so that when I save User object , the contact table should have Users's id as its primaryKey ?
Public class User{
public String username;
public long id;
public Contact contact;
}
public class Contact {
public long id;
public string phone;
public string email;
}
Something similar to this