Class LoaderHelper

java.lang.Object
org.hibernate.loader.ast.internal.LoaderHelper

public class LoaderHelper extends Object
  • Constructor Details

    • LoaderHelper

      public LoaderHelper()
  • Method Details

    • upgradeLock

      public static void upgradeLock(Object object, EntityEntry entry, LockOptions lockOptions, EventSource session)
      Ensure the LockMode associated with the entity in relation to a persistence context is great or equal to the requested mode, performing a pessimistic lock upgrade on a given entity, if needed.
      Parameters:
      object - The entity for which to upgrade the lock.
      entry - The entity's EntityEntry instance.
      lockOptions - Contains the requested lock mode.
      session - The session which is the source of the event being processed.
    • getReadOnlyFromLoadQueryInfluencers

      public static Boolean getReadOnlyFromLoadQueryInfluencers(SharedSessionContractImplementor session)
      Determine if the influencers associated with the given Session indicate read-only
    • getReadOnlyFromLoadQueryInfluencers

      public static Boolean getReadOnlyFromLoadQueryInfluencers(LoadQueryInfluencers loadQueryInfluencers)
      Determine if given influencers indicate read-only
    • normalizeKeys

      public static <K> K[] normalizeKeys(K[] keys, BasicValuedModelPart keyPart, SharedSessionContractImplementor session, SessionFactoryImplementor sessionFactory)
      Normalize an array of keys (primary, foreign or natural).

      If the array is already typed as the key type, keys is simply returned.

      Otherwise, a new typed array is created and the contents copied from keys to this new array. If key coercion is enabled, the values will be coerced to the key type.

      Type Parameters:
      K - The key type
      Parameters:
      keys - The keys to normalize
      keyPart - The ModelPart describing the key
    • createTypedArray

      public static <X> X[] createTypedArray(Class<X> elementClass, int length)
      Creates a typed array, as opposed to a generic Object[] that holds the typed values
      Parameters:
      elementClass - The type of the array elements. See Class.getComponentType()
      length - The length to which the array should be created. This is usually zero for Hibernate uses
    • loadByArrayParameter

      public static <R, K> List<R> loadByArrayParameter(K[] idsToInitialize, SelectStatement sqlAst, JdbcOperationQuerySelect jdbcOperation, JdbcParameter jdbcParameter, JdbcMapping arrayJdbcMapping, Object entityId, Object entityInstance, EntityMappingType rootEntityDescriptor, LockOptions lockOptions, Boolean readOnly, SharedSessionContractImplementor session)
      Load one or more instances of a model part (an entity or collection) based on a SQL ARRAY parameter to specify the keys (as opposed to the more traditional SQL IN predicate approach).
      Type Parameters:
      R - The type of the model part to load
      K - The type of the keys