Module eclipselink
Annotation Interface VariableOneToOne
Variable one to one mappings are used to represent a pointer references
between a java object and an implementer of an interface. This mapping is
usually represented by a single pointer (stored in an instance variable)
between the source and target objects. In the relational database tables,
these mappings are normally implemented using a foreign key and a type code.
A VariableOneToOne can be specified within an Entity, MappedSuperclass and Embeddable class.
- Author:
- Guy Pelletier
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionjakarta.persistence.CascadeType[]The operations that must be cascaded to the target of the association.The list of discriminator types that can be used with this VariableOneToOne.jakarta.persistence.DiscriminatorColumnThe discriminator column will hold the type indicators.jakarta.persistence.FetchTypeDefines whether the value of the field or property should be lazily loaded or must be eagerly fetched.booleanWhether the association is optional.booleanWhether to apply the remove operation to entities that have been removed from the relationship and to cascade the remove operation to those entities.Class<?> The interface class that is the target of the association.
-
Element Details
-
targetInterface
Class<?> targetInterfaceThe interface class that is the target of the association. If not specified it will be inferred from the type of the object being referenced.- Default:
void.class
-
cascade
jakarta.persistence.CascadeType[] cascadeThe operations that must be cascaded to the target of the association.- Default:
{}
-
fetch
jakarta.persistence.FetchType fetchDefines whether the value of the field or property should be lazily loaded or must be eagerly fetched. The FetchType.EAGER strategy is a requirement on the persistence provider runtime that the value must be eagerly fetched. The FetchType.LAZY strategy is a hint to the persistence provider runtime. If not specified, defaults to FetchType.EAGER.- Default:
EAGER
-
optional
boolean optionalWhether the association is optional. If set to false then a non-null relationship must always exist.- Default:
true
-
orphanRemoval
boolean orphanRemovalWhether to apply the remove operation to entities that have been removed from the relationship and to cascade the remove operation to those entities.- Default:
false
-
discriminatorColumn
jakarta.persistence.DiscriminatorColumn discriminatorColumnThe discriminator column will hold the type indicators. If the discriminatorColumn is not specified, the name of the discriminator column defaults to "DTYPE" and the discriminator type to DiscriminatorType.STRING.- Default:
@jakarta.persistence.DiscriminatorColumn
-
discriminatorClasses
DiscriminatorClass[] discriminatorClassesThe list of discriminator types that can be used with this VariableOneToOne. If none are specified then those entities within the persistence unit that implement the target interface will be added to the list of types. The discriminator type will default as follows:- If discriminatorColumn() type is DiscriminatorType.STRING: Entity.name()
- If discriminatorColumn() type is DiscriminatorType.CHAR: First letter of the Entity class
- If discriminatorColumn() type is DiscriminatorType.INTEGER: The next integer after the highest integer explicitly added.
- Default:
{}
-