Enum LazyToOneOption

    • Enum Constant Detail

      • FALSE

        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.
      • PROXY

        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 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 Hibernate.unproxy(Object, Class)} must be used to perform typecasts, and Hibernate.getClass(Object) must be used instead of the Java instanceof operator.
      • NO_PROXY

        public static final LazyToOneOption NO_PROXY
        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.

    • Method Detail

      • values

        public static LazyToOneOption[] values()
        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())
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static LazyToOneOption valueOf​(String name)
        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.)
        name - the name of the enum constant to be returned.
        the enum constant with the specified name
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null