i have two tables which has one-to-one mapping on a column. i'd like to set up unidirectional one-to-one hibernate mapping using annotations because i want to be able to get results from joined tables, but do not want to do foreign constraint check for child table.
here's my quick code.
@Entity
@Table(name = "student")
public class student {
// primary key and other column definition here..
    @OneToOne(cascade = CascadeType.ALL)
    @JoinColumn(name="address_id")
    private Address address;
// getters and //setters
}
@Entity
@Tale(name = "address") 
public class address {
    @Id
    @GeneratedValue(generator = "hibernate-uuid")
    @GenericGenerator(name = "hibernate-uuid", strategy = uuid")
    @Column(name = "id", unique = true, length = 36, nullable = false)
    private String id;
    @Column(name="address_id")
    private String address_id;
    // getters and setters
}
above gives me following exception when i try to insert into student (but not the address).
Caused by: org.hibernate.AnnotationException: A Foreign key refering com.test.Student from com.test.Address has the wrong number of column. should be 2
what am i doing wrong here?
 
     
    