Top Description Fields Constructors Methods
org.hibernate.annotations

public final Enum LazyToOneOption

extends Enum<LazyToOneOption>
Class Inheritance
Annotations
@Deprecated
since:6.2

Deprecated

since 6.2.

since LazyToOne is deprecated, use jakarta.persistence.FetchType instead

Enumerates the options for lazy loading of a many to one or one to one association.
Author
Emmanuel Bernard
See Also
LazyToOne

Field Summary

Modifier and TypeField and Description
public static final LazyToOneOption
FALSE

The association is always loaded eagerly.

public static final LazyToOneOption
NO_PROXY

The 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.

public static final LazyToOneOption
PROXY

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.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static LazyToOneOption
valueOf(String name)

Deprecated as a consequence of LazyToOneOption being deprecated.
public static LazyToOneOption[]
values()

Deprecated as a consequence of LazyToOneOption being deprecated.
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

FALSEback to summary
public static final LazyToOneOption FALSE

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.

Annotations
@Deprecated
NO_PROXYback to summary
public static final LazyToOneOption NO_PROXY

Deprecated

this setting no longer has any useful effect

The 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, and Object#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.

Annotations
@Deprecated
PROXYback to summary
public static final LazyToOneOption PROXY

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 org.hibernate.Hibernate#getClass(Object) must be used in place of Object#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 org.hibernate.Hibernate#unproxy(Object, Class)} must be used to perform typecasts, and org.hibernate.Hibernate#getClass(Object) must be used instead of the Java instanceof operator.
Annotations
@Deprecated

Constructor Detail

LazyToOneOptionback to summary
private LazyToOneOption()

Method Detail

valueOfback to summary
public static LazyToOneOption valueOf(String name)

Deprecated

as a consequence of LazyToOneOption being deprecated. See corresponding docs for further information.

valuesback to summary
public static LazyToOneOption[] values()

Deprecated

as a consequence of LazyToOneOption being deprecated. See corresponding docs for further information.