Edit in parent table
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private int num;
//bi-directional one-to-one association to Childtable
@OneToOne(fetch = FetchType.LAZY, mappedBy = "parenttable", cascade = CascadeType.ALL)
private Childtable childtable;
Edit in child table
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String email;
private String name;
//bi-directional one-to-one association to Parenttable
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
private Parenttable parenttable;