Tabnine Logo
ArrayHelper.countNonNull
Code IndexAdd Tabnine to your IDE (free)

How to use
countNonNull
method
in
org.hibernate.internal.util.collections.ArrayHelper

Best Java code snippets using org.hibernate.internal.util.collections.ArrayHelper.countNonNull (Showing top 8 results out of 315)

origin: hibernate/hibernate-orm

public static Serializable[] extractNonNull(Serializable[] array) {
  final int nonNullCount = countNonNull( array );
  final Serializable[] result = new Serializable[nonNullCount];
  int i = 0;
  for ( Serializable element : array ) {
    if ( element != null ) {
      result[i++] = element;
    }
  }
  if ( i != nonNullCount ) {
    throw new HibernateException( "Number of non-null elements varied between iterations" );
  }
  return result;
}
origin: hibernate/hibernate-orm

  @Override
  public void initialize(Serializable id, SharedSessionContractImplementor session) throws HibernateException {
    // first, figure out how many batchable ids we have...
    final Serializable[] batch = session.getPersistenceContext()
        .getBatchFetchQueue()
        .getCollectionBatch( collectionPersister(), id, maxBatchSize );
    final int numberOfIds = ArrayHelper.countNonNull( batch );
    if ( numberOfIds <= 1 ) {
      singleKeyLoader.loadCollection( session, id, collectionPersister().getKeyType() );
      return;
    }
    final Serializable[] idsToLoad = new Serializable[numberOfIds];
    System.arraycopy( batch, 0, idsToLoad, 0, numberOfIds );
    batchLoader.doBatchedCollectionLoad( session, idsToLoad, collectionPersister().getKeyType() );
  }
}
origin: hibernate/hibernate-orm

  @Override
  public void initialize(Serializable id, SharedSessionContractImplementor session)	throws HibernateException {
    final Serializable[] batch = session.getPersistenceContext()
        .getBatchFetchQueue()
        .getCollectionBatch( collectionPersister(), id, batchSizes[0] );
    final int numberOfIds = ArrayHelper.countNonNull( batch );
    if ( numberOfIds <= 1 ) {
      loaders[batchSizes.length-1].loadCollection( session, id, collectionPersister().getKeyType() );
      return;
    }
    // Uses the first batch-size bigger than the number of actual ids in the batch
    int indexToUse = batchSizes.length-1;
    for ( int i = 0; i < batchSizes.length-1; i++ ) {
      if ( batchSizes[i] >= numberOfIds ) {
        indexToUse = i;
      }
      else {
        break;
      }
    }
    final Serializable[] idsToLoad = new Serializable[ batchSizes[indexToUse] ];
    System.arraycopy( batch, 0, idsToLoad, 0, numberOfIds );
    for ( int i = numberOfIds; i < batchSizes[indexToUse]; i++ ) {
      idsToLoad[i] = id;
    }
    loaders[indexToUse].loadCollectionBatch( session, idsToLoad, collectionPersister().getKeyType() );
  }
}
origin: hibernate/hibernate-orm

    .getEntityBatch( persister(), id, batchSizes[0], persister().getEntityMode() );
final int numberOfIds = ArrayHelper.countNonNull( batch );
if ( numberOfIds <= 1 ) {
  final Object result =  ( (UniqueEntityLoader) loaders[batchSizes.length-1] ).load( id, optionalObject, session );
origin: hibernate/hibernate-orm

protected AbstractCollectionReference(
    ExpandingCollectionQuerySpace collectionQuerySpace,
    PropertyPath propertyPath,
    boolean shouldIncludeJoins) {
  this.collectionQuerySpace = collectionQuerySpace;
  this.propertyPath = propertyPath;
  this.allowElementJoin = shouldIncludeJoins;
  // Currently we can only allow a join for the collection index if all of the following are true:
  // - collection element joins are allowed;
  // - index is an EntityType;
  // - index values are not "formulas" (e.g., a @MapKey index is translated into "formula" value(s)).
  // Hibernate cannot currently support eager joining of associations within a component (@Embeddable) as an index.
  if ( shouldIncludeJoins &&
      collectionQuerySpace.getCollectionPersister().hasIndex() &&
      collectionQuerySpace.getCollectionPersister().getIndexType().isEntityType()  ) {
    final String[] indexFormulas =
        ( (QueryableCollection) collectionQuerySpace.getCollectionPersister() ).getIndexFormulas();
    final int nNonNullFormulas = ArrayHelper.countNonNull( indexFormulas );
    this.allowIndexJoin = nNonNullFormulas == 0;
  }
  else {
    this.allowIndexJoin = false;
  }
  // All other fields must be initialized before building this.index and this.element.
  this.index = buildIndexGraph();
  this.element = buildElementGraph();
}
origin: hibernate/hibernate-orm

    .getEntityBatch( persister(), id, maxBatchSize, persister().getEntityMode() );
final int numberOfIds = ArrayHelper.countNonNull( batch );
if ( numberOfIds <= 1 ) {
  final Object result =  singleKeyLoader.load( id, optionalObject, session );
origin: org.hibernate.orm/hibernate-core

public static Serializable[] extractNonNull(Serializable[] array) {
  final int nonNullCount = countNonNull( array );
  final Serializable[] result = new Serializable[nonNullCount];
  int i = 0;
  for ( Serializable element : array ) {
    if ( element != null ) {
      result[i++] = element;
    }
  }
  if ( i != nonNullCount ) {
    throw new HibernateException( "Number of non-null elements varied between iterations" );
  }
  return result;
}
origin: hibernate/hibernate-ogm

@Override
public Object load(Serializable id, Object optionalObject, SharedSessionContractImplementor session, LockOptions lockOptions) {
  final Serializable[] batch = session.getPersistenceContext()
      .getBatchFetchQueue()
      .getEntityBatch( persister(), id, maxBatchSize, persister().getEntityMode() );
  final int numberOfIds = ArrayHelper.countNonNull( batch );
  if ( numberOfIds <= 1 ) {
    return singleKeyLoader.load( id, optionalObject, session );
  }
  final Serializable[] idsToLoad = new Serializable[numberOfIds];
  System.arraycopy( batch, 0, idsToLoad, 0, numberOfIds );
  return doBatchLoad( id, dynamicLoader, session, idsToLoad, optionalObject, lockOptions );
}
org.hibernate.internal.util.collectionsArrayHelpercountNonNull

Popular methods of ArrayHelper

  • fillArray
  • countTrue
  • isAllFalse
  • join
  • getBatchSizes
  • getNextBatchSize
  • hash
    calculate the array hash (only the first level)
  • indexOf
  • toIntArray
  • toString
  • toStringArray
  • addAll
  • toStringArray,
  • addAll,
  • isAllNegative,
  • slice,
  • to2DIntArray,
  • to2DStringArray,
  • toBooleanArray,
  • toList,
  • toTypeArray

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSystemService (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Path (java.nio.file)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now