Package org.hibernate.type

Examples of org.hibernate.type.CollectionType


      }
     
      // If many-to-many, delete the FK row in the collection table.
      for ( Type type : persister.getPropertyTypes() ) {
        if ( type.isCollectionType() ) {
          final CollectionType cType = (CollectionType) type;
          final AbstractCollectionPersister cPersister = (AbstractCollectionPersister) factory
              .getCollectionPersister( cType.getRole() );
          if ( cPersister.isManyToMany() ) {
            if ( persister.getIdentifierColumnNames().length > 1
                && !dialect.supportsTuplesInSubqueries() ) {
              LOG.warn(
                  "This dialect is unable to cascade the delete into the many-to-many join table" +
View Full Code Here


      ExpandingQuerySpace lhsQuerySpace,
      AssociationAttributeDefinition attributeDefinition,
      String querySpaceUid,
      FetchStrategy fetchStrategy) {

    final CollectionType fetchedType = (CollectionType) attributeDefinition.getType();
    final CollectionPersister fetchedPersister = attributeDefinition.toCollectionDefinition().getCollectionPersister();

    if ( fetchedPersister == null ) {
      throw new WalkingException(
          String.format(
              "Unable to locate CollectionPersister [%s] for fetch [%s]",
              fetchedType.getRole(),
              attributeDefinition.getName()
          )
      );
    }
View Full Code Here

      componentPath += tokens.nextToken();
      Type type = provider.getType( componentPath );
      if ( type.isAssociationType() ) {
        // CollectionTypes are always also AssociationTypes - but there's not always an associated entity...
        AssociationType atype = ( AssociationType ) type;
        CollectionType ctype = type.isCollectionType() ? (CollectionType)type : null;
        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

  }

  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

    }

    FromReferenceNode mapReference = getMapReference();
    mapReference.resolve( true, true );
    if ( mapReference.getDataType().isCollectionType() ) {
      CollectionType collectionType = (CollectionType) mapReference.getDataType();
      if ( Map.class.isAssignableFrom( collectionType.getReturnedClass() ) ) {
        FromElement sourceFromElement = mapReference.getFromElement();
        setFromElement( sourceFromElement );
        setDataType( resolveType( sourceFromElement.getQueryableCollection() ) );
        this.columns = resolveColumns( sourceFromElement.getQueryableCollection() );
        initText( this.columns );
View Full Code Here

    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

    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

        }

    final SessionFactoryImplementor sessionFactory = ( (SessionImplementor) session ).getFactory();
    final Type propertyType = sessionFactory.getEntityPersister( entityName ).getPropertyType( propertyName );
    if ( propertyType.isCollectionType() ) {
      CollectionType collectionPropertyType = (CollectionType) propertyType;
      // Handling collection of components.
      if ( collectionPropertyType.getElementType( sessionFactory ) instanceof ComponentType ) {
        // Adding restrictions to compare data outside of primary key.
        for ( Map.Entry<String, Object> dataEntry : persistentCollectionChangeData.getData().entrySet() ) {
          if ( !originalIdPropName.equals( dataEntry.getKey() ) ) {
            qb.getRootParameters().addWhereWithParam( dataEntry.getKey(), true, "=", dataEntry.getValue() );
          }
View Full Code Here

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

    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();
    int joinType = JoinFragment.INNER_JOIN;
View Full Code Here

TOP

Related Classes of org.hibernate.type.CollectionType

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.