Package org.hibernate.annotations
Enum LazyToOneOption
- java.lang.Object
-
- java.lang.Enum<LazyToOneOption>
-
- org.hibernate.annotations.LazyToOneOption
-
- All Implemented Interfaces:
Serializable
,Comparable<LazyToOneOption>
@Deprecated(since="6.2") public enum LazyToOneOption extends Enum<LazyToOneOption>
Enumerates the options for lazy loading of a many to one or one to one association.- See Also:
LazyToOne
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FALSE
Deprecated.useFetchType.EAGER
NO_PROXY
Deprecated.this setting no longer has any useful effectPROXY
Deprecated.useFetchType.LAZY
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static LazyToOneOption
valueOf(String name)
Deprecated.Returns the enum constant of this type with the specified name.static LazyToOneOption[]
values()
Deprecated.Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
FALSE
@Deprecated public static final LazyToOneOption FALSE
Deprecated.useFetchType.EAGER
The association is always loaded eagerly. The identifier and concrete type of the associated entity instance, along with all the rest of its non-lazy fields, are always available immediately.
-
PROXY
@Deprecated public static final LazyToOneOption PROXY
Deprecated.useFetchType.LAZY
The association is proxied and a delegate entity instance is lazily fetched when any method of the proxy other than the getter method for the identifier property is first called.- The identifier property of the proxy object is set when the proxy is instantiated. The program may obtain the entity identifier value of an unfetched proxy, without triggering lazy fetching, by calling the corresponding getter method.
- The proxy does not have the same concrete type as the
proxied delegate, and so
Hibernate.getClass(Object)
must be used in place ofObject.getClass()
, and this method fetches the entity by side-effect. - For a polymorphic association, the concrete type of
the proxied entity instance is not known until the
delegate is fetched from the database, and so
Hibernate.unproxy(Object, Class)
} must be used to perform typecasts, andHibernate.getClass(Object)
must be used instead of the Javainstanceof
operator.
-
NO_PROXY
@Deprecated public static final LazyToOneOption NO_PROXY
Deprecated.this setting no longer has any useful effectThe associated entity instance is initially in an unloaded state, and is loaded lazily when any field other than the field containing the identifier is first accessed.- The identifier field of an unloaded entity instance is set when the unloaded instance is instantiated. The program may obtain the identifier of an unloaded entity, without triggering lazy fetching, by accessing the field containing the identifier.
- Typecasts, the Java
instanceof
operator, andObject.getClass()
may be used as normal. - Bytecode enhancement is required. If the class is not
enhanced, this option is equivalent to
PROXY
.
Hibernate does not support this setting for polymorphic associations, and instead falls back to
PROXY
.
-
-
Method Detail
-
values
public static LazyToOneOption[] values()
Deprecated.Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (LazyToOneOption c : LazyToOneOption.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LazyToOneOption valueOf(String name)
Deprecated.Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
-