@OneToOne annotation specifies an association to another entity that has one-to-one multiplicity. Following example demonstrates that setting @OneToOne(optional=false) makes the association mandatory. For a mandatory association, the target entity cannot be persisted when it's associated reference is null.
The default value of 'optional' element is true.
Example ProjectDependencies and Technologies Used: - h2 1.4.193: H2 Database Engine.
- hibernate-core 5.2.8.Final: The core O/RM functionality as provided by Hibernate.
Implements javax.persistence:javax.persistence-api version 2.1 - JDK 1.8
- Maven 3.3.9
|