Package org.hibernate.internal.util.collections

Examples of org.hibernate.internal.util.collections.IdentitySet


    else {
      queryParametersToUse = queryParameters;
    }

    List combinedResults = new ArrayList();
    IdentitySet distinction = new IdentitySet();
    int includedCount = -1;
    translator_loop:
    for ( QueryTranslator translator : translators ) {
      List tmp = translator.list( session, queryParametersToUse );
      if ( needsLimit ) {
        // NOTE : firstRow is zero-based
        final int first = queryParameters.getRowSelection().getFirstRow() == null
            ? 0
            : queryParameters.getRowSelection().getFirstRow();
        final int max = queryParameters.getRowSelection().getMaxRows() == null
            ? -1
            : queryParameters.getRowSelection().getMaxRows();
        for ( final Object result : tmp ) {
          if ( !distinction.add( result ) ) {
            continue;
          }
          includedCount++;
          if ( includedCount < first ) {
            continue;
View Full Code Here


            : queryParameters.getRowSelection().getFirstRow();
      int max = !hasLimit || queryParameters.getRowSelection().getMaxRows() == null
            ? -1
            : queryParameters.getRowSelection().getMaxRows();
      List tmp = new ArrayList();
      IdentitySet distinction = new IdentitySet();
      for ( final Object result : results ) {
        if ( !distinction.add( result ) ) {
          continue;
        }
        includedCount++;
        if ( includedCount < first ) {
          continue;
View Full Code Here

    else {
      queryParametersToUse = queryParameters;
    }

    final List combinedResults = new ArrayList();
    final IdentitySet distinction = new IdentitySet();
    int includedCount = -1;
    translator_loop:
    for ( QueryTranslator translator : translators ) {
      final List tmp = translator.list( session, queryParametersToUse );
      if ( needsLimit ) {
        // NOTE : firstRow is zero-based
        final int first = queryParameters.getRowSelection().getFirstRow() == null
            ? 0
            : queryParameters.getRowSelection().getFirstRow();
        final int max = queryParameters.getRowSelection().getMaxRows() == null
            ? -1
            : queryParameters.getRowSelection().getMaxRows();
        for ( final Object result : tmp ) {
          if ( !distinction.add( result ) ) {
            continue;
          }
          includedCount++;
          if ( includedCount < first ) {
            continue;
View Full Code Here

  @SuppressWarnings({ "unchecked" })
  private void addDependenciesByTransientEntity(AbstractEntityInsertAction insert, NonNullableTransientDependencies dependencies) {
    for ( Object transientEntity : dependencies.getNonNullableTransientEntities() ) {
      Set<AbstractEntityInsertAction> dependentActions = dependentActionsByTransientEntity.get( transientEntity );
      if ( dependentActions == null ) {
        dependentActions = new IdentitySet();
        dependentActionsByTransientEntity.put( transientEntity, dependentActions );
      }
      dependentActions.add( insert );
    }
  }
View Full Code Here

        );
      }
      // NOTE EARLY EXIT!
      return Collections.emptySet();
    }
    final Set<AbstractEntityInsertAction> resolvedActions = new IdentitySet(  );
    if ( traceEnabled  ) {
      LOG.tracev(
          "Unresolved inserts before resolving [{0}]: [{1}]",
          MessageHelper.infoString( entityEntry.getEntityName(), entityEntry.getId() ),
          toString()
      );
    }
    for ( AbstractEntityInsertAction dependentAction : dependentActions ) {
      if ( traceEnabled ) {
        LOG.tracev(
            "Resolving insert [{0}] dependency on [{1}]",
            MessageHelper.infoString( dependentAction.getEntityName(), dependentAction.getId() ),
            MessageHelper.infoString( entityEntry.getEntityName(), entityEntry.getId() )
        );
      }
      final NonNullableTransientDependencies dependencies = dependenciesByAction.get( dependentAction );
      dependencies.resolveNonNullableTransientEntity( managedEntity );
      if ( dependencies.isEmpty() ) {
        if ( traceEnabled ) {
          LOG.tracev(
              "Resolving insert [{0}] (only depended on [{1}])",
              dependentAction,
              MessageHelper.infoString( entityEntry.getEntityName(), entityEntry.getId() )
          );
        }
        // dependentAction only depended on managedEntity..
        dependenciesByAction.remove( dependentAction );
        resolvedActions.add( dependentAction );
      }
    }
    if ( traceEnabled  ) {
      LOG.tracev(
          "Unresolved inserts after resolving [{0}]: [{1}]",
View Full Code Here

      int max = !hasLimit || queryParameters.getRowSelection().getMaxRows() == null
            ? -1
            : queryParameters.getRowSelection().getMaxRows().intValue();
      int size = results.size();
      List tmp = new ArrayList();
      IdentitySet distinction = new IdentitySet();
      for ( int i = 0; i < size; i++ ) {
        final Object result = results.get( i );
        if ( !distinction.add( result ) ) {
          continue;
        }
        includedCount++;
        if ( includedCount < first ) {
          continue;
View Full Code Here

    // create the collection holding the Orphans
    final Collection res = new ArrayList();

    // collect EntityIdentifier(s) of the *current* elements - add them into a HashSet for fast access
    final java.util.Set currentIds = new HashSet();
    final java.util.Set currentSaving = new IdentitySet();
    for ( Object current : currentElements ) {
      if ( current != null && ForeignKeys.isNotTransient( entityName, current, null, session ) ) {
        final EntityEntry ee = session.getPersistenceContext().getEntry( current );
        if ( ee != null && ee.getStatus() == Status.SAVING ) {
          currentSaving.add( current );
        }
        else {
          final Serializable currentId = ForeignKeys.getEntityIdentifierIfNotUnsaved(
              entityName,
              current,
              session
          );
          currentIds.add( new TypedValue( idType, currentId ) );
        }
      }
    }

    // iterate over the *old* list
    for ( Object old : oldElements ) {
      if ( !currentSaving.contains( old ) ) {
        final Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, old, session );
        if ( !currentIds.contains( new TypedValue( idType, oldId ) ) ) {
          res.add( old );
        }
      }
View Full Code Here

   * @param event The delete event to be handled.
   *
   * @throws HibernateException
   */
  public void onDelete(DeleteEvent event) throws HibernateException {
    onDelete( event, new IdentitySet() );
  }
View Full Code Here

   * @param event The delete event to be handled.
   *
   * @throws HibernateException
   */
  public void onDelete(DeleteEvent event) throws HibernateException {
    onDelete( event, new IdentitySet() );
  }
View Full Code Here

    else {
      queryParametersToUse = queryParameters;
    }

    List combinedResults = new ArrayList();
    IdentitySet distinction = new IdentitySet();
    int includedCount = -1;
    translator_loop: for ( int i = 0; i < translators.length; i++ ) {
      List tmp = translators[i].list( session, queryParametersToUse );
      if ( needsLimit ) {
        // NOTE : firstRow is zero-based
        int first = queryParameters.getRowSelection().getFirstRow() == null
                    ? 0
                      : queryParameters.getRowSelection().getFirstRow().intValue();
        int max = queryParameters.getRowSelection().getMaxRows() == null
                    ? -1
                      : queryParameters.getRowSelection().getMaxRows().intValue();
        final int size = tmp.size();
        for ( int x = 0; x < size; x++ ) {
          final Object result = tmp.get( x );
          if ( ! distinction.add( result ) ) {
            continue;
          }
          includedCount++;
          if ( includedCount < first ) {
            continue;
View Full Code Here

TOP

Related Classes of org.hibernate.internal.util.collections.IdentitySet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.