Examples of CollectionType


Examples of org.hibernate.type.CollectionType

      return checkComponentNullability( value, (CompositeType) propertyType );
    }
    else if ( propertyType.isCollectionType() ) {

      //persistent collections may have components
      CollectionType collectionType = (CollectionType) propertyType;
      Type collectionElementType = collectionType.getElementType( session.getFactory() );
      if ( collectionElementType.isComponentType() ) {
        //check for all components values in the collection

        CompositeType componentType = (CompositeType) collectionElementType;
        Iterator iter = CascadingAction.getLoadedElementsIterator(session, collectionType, value);
View Full Code Here

Examples of org.hibernate.type.CollectionType

   
    // If many-to-many, delete the FK row in the collection table.
    // This partially overlaps with DeleteExecutor, but it instead uses the temp table in the idSubselect.
    for ( Type type : targetedPersister.getPropertyTypes() ) {
      if ( type.isCollectionType() ) {
        CollectionType cType = (CollectionType) type;
        AbstractCollectionPersister cPersister = (AbstractCollectionPersister)factory.getCollectionPersister( cType.getRole() );
        if ( cPersister.isManyToMany() ) {
          deletes.add( generateDelete( cPersister.getTableName(),
              cPersister.getKeyColumnNames(), idSubselect, "bulk delete - m2m join table cleanup"));
        }
      }
View Full Code Here

Examples of org.hibernate.type.CollectionType

      componentPath += tokens.nextToken();
      final Type type = provider.getType( componentPath );
      if ( type.isAssociationType() ) {
        // CollectionTypes are always also AssociationTypes - but there's not always an associated entity...
        final AssociationType atype = (AssociationType) type;
        final CollectionType ctype = type.isCollectionType() ? (CollectionType)type : null;
        final Type elementType = (ctype != null) ? ctype.getElementType( sessionFactory ) : null;
        // is the association a collection of components or value-types? (i.e a colloction of valued types?)
        if ( ctype != null  && elementType.isComponentType() ) {
          provider = new ComponentCollectionCriteriaInfoProvider( helper.getCollectionPersister(ctype.getRole()) );
        }
        else if ( ctype != null && !elementType.isEntityType() ) {
          provider = new ScalarCollectionCriteriaInfoProvider( helper, ctype.getRole() );
        }
        else {
          provider = new EntityCriteriaInfoProvider(
              (Queryable) sessionFactory.getEntityPersister( atype.getAssociatedEntityName( sessionFactory ) )
          );
View Full Code Here

Examples of org.hibernate.type.CollectionType

  }

  private void addAssociationsToTheSetForOneProperty(String name, Type type, String prefix, SessionFactoryImplementor factory) {

    if ( type.isCollectionType() ) {
      CollectionType collType = (CollectionType) type;
      Type assocType = collType.getElementType( factory );
      addAssociationsToTheSetForOneProperty(name, assocType, prefix, factory);
    }
    //ToOne association
    else if ( type.isEntityType() || type.isAnyType() ) {
      associations.add( prefix + name );
View Full Code Here

Examples of org.hibernate.type.CollectionType

        sourceFromElement = mapReference.getFromElement();
      }
    }
    else {
      if ( mapReference.getDataType().isCollectionType() ) {
        final CollectionType collectionType = (CollectionType) mapReference.getDataType();
        if ( Map.class.isAssignableFrom( collectionType.getReturnedClass() ) ) {
          sourceFromElement = mapReference.getFromElement();
        }
      }
    }
View Full Code Here

Examples of org.hibernate.type.CollectionType

                role,
                null
            );
          }
          else if ( propertyType.isCollectionType() ) {
            CollectionType collectionType = (CollectionType) propertyType;
            final String[] columns = origin.toColumns( originTableAlias, attributeName, false );

            final FromElementFactory fromElementFactory = new FromElementFactory(
                fromClause, origin,
                attributeName, classAlias, columns, false
            );
            final QueryableCollection queryableCollection = walker.getSessionFactoryHelper()
                .requireQueryableCollection( collectionType.getRole() );
            fromElement = fromElementFactory.createCollection(
                queryableCollection, collectionType.getRole(), JoinType.LEFT_OUTER_JOIN, true, false
            );
          }
        }

        if ( fromElement != null ) {
View Full Code Here

Examples of org.hibernate.type.CollectionType

      return checkComponentNullability( value, (CompositeType) propertyType );
    }

    if ( propertyType.isCollectionType() ) {
      // persistent collections may have components
      final CollectionType collectionType = (CollectionType) propertyType;
      final Type collectionElementType = collectionType.getElementType( session.getFactory() );

      if ( collectionElementType.isComponentType() ) {
        // check for all components values in the collection
        final CompositeType componentType = (CompositeType) collectionElementType;
        final Iterator itr = CascadingActions.getLoadedElementsIterator( session, collectionType, value );
View Full Code Here

Examples of org.hibernate.type.CollectionType

        return null;
      }
      return getEntity( session.generateEntityKey( owenerId, ownerPersister ) );
    }

    final CollectionType collectionType = collectionPersister.getCollectionType();

    //    2) The incoming key is most likely the collection key which we need to resolve to the owner key
    //      find the corresponding owner instance
    //      a) try by EntityUniqueKey
    if ( collectionType.getLHSPropertyName() != null ) {
      final Object owner = getEntity(
          new EntityUniqueKey(
              ownerPersister.getEntityName(),
              collectionType.getLHSPropertyName(),
              key,
              collectionPersister.getKeyType(),
              ownerPersister.getEntityMode(),
              session.getFactory()
          )
      );
      if ( owner != null ) {
        return owner;
      }

      //    b) try by EntityKey, which means we need to resolve owner-key -> collection-key
      //      IMPL NOTE : yes if we get here this impl is very non-performant, but PersistenceContext
      //          was never designed to handle this case; adding that capability for real means splitting
      //          the notions of:
      //            1) collection key
      //            2) collection owner key
      //           these 2 are not always the same (same is true in the case of ToOne associations with
      //           property-ref).  That would require changes to (at least) CollectionEntry and quite
      //          probably changes to how the sql for collection initializers are generated
      //
      //      We could also possibly see if the referenced property is a natural id since we already have caching
      //      in place of natural id snapshots.  BUt really its better to just do it the right way ^^ if we start
      //       going that route
      final Serializable ownerId = ownerPersister.getIdByUniqueKey( key, collectionType.getLHSPropertyName(), session );
      return getEntity( session.generateEntityKey( ownerId, ownerPersister ) );
    }

    // as a last resort this is what the old code did...
    return getEntity( session.generateEntityKey( key, collectionPersister.getOwnerEntityPersister() ) );
View Full Code Here

Examples of org.hibernate.type.CollectionType

    fromClause.addCollectionJoinFromElementByPath( path, destination );
//    origin.addDestination(destination);
    // Add the query spaces.
    fromClause.getWalker().addQuerySpaces( entityPersister.getQuerySpaces() );

    CollectionType type = queryableCollection.getCollectionType();
    String role = type.getRole();
    String roleAlias = origin.getTableAlias();

    String[] targetColumns = sfh.getCollectionElementColumns( role, roleAlias );
    AssociationType elementAssociationType = sfh.getElementAssociationType( type );
View Full Code Here

Examples of org.hibernate.type.CollectionType

    if (!getDataType().isCollectionType()) {
      throw new SemanticException("Collection expected; [" + propertyName + "] does not refer to a collection property");
    }

    // TODO : most of below was taken verbatim from DotNode; should either delegate this logic or super-type it
    CollectionType type = (CollectionType) getDataType();
    String role = type.getRole();
    QueryableCollection queryableCollection = getSessionFactoryHelper().requireQueryableCollection(role);

    String alias = null// DotNode uses null here...
    String columnTableAlias = getFromElement().getTableAlias();
    JoinType joinType = JoinType.INNER_JOIN;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.