-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Currently, gentity ignores the distinction between 1:1 and 1:0..1 associations. The way @OneToOne is currently generated makes all @OneToOne associations optional=true by default (because true is the default value for the optional attribute if it is not specified, which is always the case right now).
For some background, consider the tables car and registration, where car has a foreign key column registration_id referring to registration's id column:
- if
registration_idis set asNOT NULL, then each car must have a registration. Therefore this is a 1:1 relation - if
registration_idis set asNULL(nullable), then a car may have a registration (or it may not). This is a 1:0..1 relation.
Proposal:
- For 1:0..1 relations, leave
optionalas the default (do not specifyoptional, as it is right now) - For 1:1 relations, specify
optional=falsein the@OneToOneannotation
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers