Package org.hibernate.type

Examples of org.hibernate.type.CompositeType


      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);
        while ( iter.hasNext() ) {
          Object compValue = iter.next();
          if (compValue != null) {
            return checkComponentNullability(compValue, componentType);
View Full Code Here


                    joinable.getTableName(),
                    getRHSColumnNames( aType, sessionFactory() )
                );
              }

              final CompositeType cType = getType();
              final boolean nullable =
                  cType.getPropertyNullability() == null ||
                      cType.getPropertyNullability()[subAttributeNumber];

              return new CompositeBasedAssociationAttribute(
                  AbstractCompositionAttribute.this,
                  sessionFactory(),
                  attributeNumber(),
                  name,
                  (AssociationType) type,
                  new BaselineAttributeInformation.Builder()
                      .setInsertable( AbstractCompositionAttribute.this.isInsertable() )
                      .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
                      // todo : handle nested ValueGeneration strategies...
                      //    disallow if our strategy != NEVER
                      .setNullable( nullable )
                      .setDirtyCheckable( true )
                      .setVersionable( AbstractCompositionAttribute.this.isVersionable() )
                      .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
                      .setFetchMode( getType().getFetchMode( subAttributeNumber ) )
                      .createInformation(),
                  subAttributeNumber,
                  associationKey
              );
            }
            else if ( type.isComponentType() ) {
              return new CompositionBasedCompositionAttribute(
                  AbstractCompositionAttribute.this,
                  sessionFactory(),
                  attributeNumber(),
                  name,
                  (CompositeType) type,
                  columnPosition,
                  new BaselineAttributeInformation.Builder()
                      .setInsertable( AbstractCompositionAttribute.this.isInsertable() )
                      .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
                      // todo : handle nested ValueGeneration strategies...
                      //    disallow if our strategy != NEVER
                      .setNullable( getType().getPropertyNullability()[subAttributeNumber] )
                      .setDirtyCheckable( true )
                      .setVersionable( AbstractCompositionAttribute.this.isVersionable() )
                      .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
                      .setFetchMode( getType().getFetchMode( subAttributeNumber ) )
                      .createInformation()
              );
            }
            else {
              final CompositeType cType = getType();
              final boolean nullable = cType.getPropertyNullability() == null || cType.getPropertyNullability()[subAttributeNumber];

              return new CompositeBasedBasicAttribute(
                  AbstractCompositionAttribute.this,
                  sessionFactory(),
                  subAttributeNumber,
View Full Code Here

    }

    if (path!=null) addPropertyPath(path, type, columns, columnReaders, columnReaderTemplates, formulaTemplates);

    if ( type.isComponentType() ) {
      CompositeType actype = (CompositeType) type;
      initComponentPropertyPaths( path, actype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
      if ( actype.isEmbedded() ) {
        initComponentPropertyPaths(
            path==null ? null : StringHelper.qualifier(path),
            actype,
            columns,
            columnReaders,
View Full Code Here

  @Override
  public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) {
    final ArrayList<TypedValue> list = new ArrayList<TypedValue>();
    final Type type = criteriaQuery.getTypeUsingProjection( criteria, propertyName );
    if ( type.isComponentType() ) {
      final CompositeType compositeType = (CompositeType) type;
      final Type[] subTypes = compositeType.getSubtypes();
      for ( Object value : values ) {
        for ( int i = 0; i < subTypes.length; i++ ) {
          final Object subValue = value == null
              ? null
              : compositeType.getPropertyValues( value, EntityMode.POJO )[i];
          list.add( new TypedValue( subTypes[i], subValue ) );
        }
      }
    }
    else {
View Full Code Here

    }

    // aliases for composite-id's
    if ( getIdentifierType().isComponentType() ) {
      // Fetch embedded identifiers propertynames from the "virtual" identifier component
      CompositeType componentId = ( CompositeType ) getIdentifierType();
      String[] idPropertyNames = componentId.getPropertyNames();
      String[] idAliases = getIdentifierAliases();
      String[] idColumnNames = getIdentifierColumnNames();

      for ( int i = 0; i < idPropertyNames.length; i++ ) {
        if ( entityMetamodel.hasNonIdentifierPropertyNamedId() ) {
View Full Code Here

    }

    // aliases for composite-id's
    if ( getIdentifierType().isComponentType() ) {
      // Fetch embedded identifiers propertynames from the "virtual" identifier component
      CompositeType componentId = ( CompositeType ) getIdentifierType();
      String[] idPropertyNames = componentId.getPropertyNames();
      String[] idAliases = getIdentifierAliases();
      String[] idColumnNames = getIdentifierColumnNames();

      for ( int i = 0; i < idPropertyNames.length; i++ ) {
        if ( entityMetamodel.hasNonIdentifierPropertyNamedId() ) {
View Full Code Here

      entityIdentifierDefinition =
          EntityIdentifierDefinitionHelper.buildSimpleEncapsulatedIdentifierDefinition( this );
      return;
    }

    final CompositeType cidType = (CompositeType) idType;
    if ( !cidType.isEmbedded() ) {
      entityIdentifierDefinition =
          EntityIdentifierDefinitionHelper.buildEncapsulatedCompositeIdentifierDefinition( this );
      return;
    }
View Full Code Here

    // if the entity has a composite identifier, see if we need to handle
    // its sub-properties separately
    final Type idType = persister.getIdentifierType();
    if ( idType.isComponentType() ) {
      final CompositeType cidType = (CompositeType) idType;
      if ( cidType.isEmbedded() ) {
        // we have an embedded composite identifier.  Most likely we need to process the composite
        // properties separately, although there is an edge case where the identifier is really
        // a simple identifier (single value) wrapped in a JPA @IdClass or even in the case of a
        // a simple identifier (single value) wrapped in a Hibernate composite type.
        //
View Full Code Here

    }
    //ToOne association
    else if ( type.isEntityType() || type.isAnyType() ) {
      associations.add( prefix + name );
    } else if ( type.isComponentType() ) {
      CompositeType componentType = (CompositeType) type;
      addAssociationsToTheSetForAllProperties(
          componentType.getPropertyNames(),
          componentType.getSubtypes(),
          (prefix.equals( "" ) ? name : prefix + name) + ".",
          factory);
    }
  }
View Full Code Here

    }

    // aliases for composite-id's
    if ( getIdentifierType().isComponentType() ) {
      // Fetch embedded identifiers propertynames from the "virtual" identifier component
      CompositeType componentId = ( CompositeType ) getIdentifierType();
      String[] idPropertyNames = componentId.getPropertyNames();
      String[] idAliases = getIdentifierAliases();
      String[] idColumnNames = getIdentifierColumnNames();

      for ( int i = 0; i < idPropertyNames.length; i++ ) {
        if ( entityMetamodel.hasNonIdentifierPropertyNamedId() ) {
View Full Code Here

TOP

Related Classes of org.hibernate.type.CompositeType

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.