Christophe Verré wrote:@OneToMany (1..*) and @ManyToMany (*..*) shows that there may be any number of entities on the "right" side of the relation. There may be 0, 1, 2... The "right" side is represented by a collection.
@OneToOne(1..1) and @ManyToOne (*..1) usually represent a tight relation between one or many entities to a single entity. There may be time when you'd like to say that there's only one entity, but it's not always there. You can use "optional" to tell the container that the relation you want is something like (1..0 or 1) or (*..0 or 1).
That's why "optional" only makes sense for @OneToOne and @ManyToOne.
but again here, i can justify here
@OneToOne(1..0), will be a unidirectional relationship.. optional = true
@OneToOne(1...1), will be a bidirectional relationship. optional = false
but I think there is a possibilty of @OneToMany as unidirectional or bidirectional relationship...
in that case, it might require's optional element.
Correct me if i am wrong.