I've bumped into this example in JPA 2.0 FR Specification, 11.1.37. OneToOne Annotation, page 403:
@OneToOne(optional=false)
@JoinColumn(name="CUSTREC_ID", unique=true, nullable=false, updatable=false)
public CustomerRecord getCustomerRecord() { return customerRecord; }
Is there any reason that I should put @OneToOne(optional=false)
and at that same time put @JoinColumn(... nullable=false)
?
Aren't these two declarations the same? Isn't one of them redundant?
Are both of them used in DDL schema generation?