Package org.hibernate.type

Examples of org.hibernate.type.Type


    GridType idGridType = getIdGridType( session );
    idGridType.nullSafeSet( resultset, getIdentifier( value, session ), names, settable, session );
  }

  private GridType getIdGridType(SessionImplementor session) {
    final Type idType = delegate.getIdentifierOrUniqueKeyType( session.getFactory() );
    GridType idGridType = typeTranslator.getType( idType );
    return idGridType;
  }
View Full Code Here


  }

  private Map<String, AssociationKeyMetadata> initInverseOneToOneAssociationKeyMetadata() {
    Map<String, AssociationKeyMetadata> associationKeyMetadata = new HashMap<String, AssociationKeyMetadata>();
    for ( String property : getPropertyNames() ) {
      Type propertyType = getPropertyType( property );

      if ( !propertyType.isEntityType() ) {
        continue;
      }

      String[] propertyColumnNames = getPropertyColumnNames( getPropertyIndex( property ) );
      String[] rowKeyColumnNames = buildRowKeyColumnNamesForStarToOne( this, propertyColumnNames );
View Full Code Here

  /**
   * Returns the name from the inverse side if the given property de-notes a one-to-one association.
   */
  private String getInverseOneToOneProperty(String property, OgmEntityPersister otherSidePersister) {
    for ( String candidate : otherSidePersister.getPropertyNames() ) {
      Type candidateType = otherSidePersister.getPropertyType( candidate );
      if ( candidateType.isEntityType()
          && ( ( (EntityType) candidateType ).isOneToOne()
          && isOneToOneMatching( this, property, (OneToOneType) candidateType ) ) ) {
        return candidate;
      }
    }
View Full Code Here

   */
  private List<String> getEmbeddedCollectionColumns() {
    List<String> embeddedCollections = new ArrayList<String>();

    for ( String property : getPropertyNames() ) {
      Type propertyType = getPropertyType( property );

      if ( propertyType.isAssociationType() ) {
        Joinable associatedJoinable = ( (AssociationType) propertyType ).getAssociatedJoinable( getFactory() );

        // *-to-many
        if ( associatedJoinable.isCollection() ) {
          OgmCollectionPersister inversePersister = (OgmCollectionPersister) associatedJoinable;

          if ( gridDialect.isStoredInEntityStructure( inversePersister.getAssociationKeyMetadata(), inversePersister.getAssociationTypeContext( property ) ) ) {
            embeddedCollections.add( property );
          }
        }
        // *-to-one
        else {
          // TODO: For now I'm adding all *-to-one columns to the projection list; Actually we need to ask the
          // dialect whether it's an embedded association, which we can't find out atm. though as we need all
          // entity persisters to be set up for this
          embeddedCollections.add( property );
        }
      }
      // for embeddables check whether they contain element collections
      else if ( propertyType.isComponentType() ) {
        collectEmbeddedCollectionColumns( (ComponentType) propertyType, property, embeddedCollections );
      }
    }

    return embeddedCollections;
View Full Code Here

    return embeddedCollections;
  }

  private void collectEmbeddedCollectionColumns(ComponentType componentType, String dotName, List<String> embeddedCollections) {
    for ( String propertyName : componentType.getPropertyNames() ) {
      Type type = componentType.getSubtypes()[componentType.getPropertyIndex( propertyName )];

      if ( type.isCollectionType() ) {
        embeddedCollections.add( dotName + "." + propertyName );
      }
      else if ( type.isComponentType() ) {
        collectEmbeddedCollectionColumns( (ComponentType) type, dotName + "." + propertyName, embeddedCollections );
      }
    }
  }
View Full Code Here

  private boolean[] getPropertyMightRequireInverseAssociationManagement() {
    boolean[] propertyMightRequireInverseAssociationManagement = new boolean[getEntityMetamodel().getPropertySpan()];

    for ( int propertyIndex = 0; propertyIndex < getEntityMetamodel().getPropertySpan(); propertyIndex++ ) {
      Type propertyType = getPropertyTypes()[propertyIndex];
      boolean isStarToOne = propertyType.isAssociationType() && ! propertyType.isCollectionType();

      propertyMightRequireInverseAssociationManagement[propertyIndex] = isStarToOne || getPropertyUniqueness()[propertyIndex];
    }

    return propertyMightRequireInverseAssociationManagement;
View Full Code Here

  private TupleContext createTupleContext() {
    Map<String, AssociatedEntityKeyMetadata> associatedEntityKeyMetadata = newHashMap();
    Map<String, String> roles = newHashMap();

    for ( int index = 0; index < getPropertySpan(); index++ ) {
      final Type uniqueKeyType = getPropertyTypes()[index];
      if ( uniqueKeyType.isEntityType() ) {
        OgmEntityPersister associatedJoinable = (OgmEntityPersister) getFactory().getEntityPersister(
            ( (EntityType) uniqueKeyType ).getAssociatedEntityName() );

        for ( String column : getPropertyColumnNames( index ) ) {
          associatedEntityKeyMetadata.put( column, new AssociatedEntityKeyMetadata( getPropertyColumnNames( index ), associatedJoinable.getEntityKeyMetadata() ) );
View Full Code Here

    }
  }

  private GridType getUniqueKeyTypeFromAssociatedEntity(int propertyIndex, String propertyName) {
    GridType gridUniqueKeyType;//get the unique key type and if it's an entity type, get it's identifier type
    final Type uniqueKeyType = getPropertyTypes()[propertyIndex];
    if ( uniqueKeyType.isEntityType() ) {
      //we run under the assumption that we are fully in an OGM world
      EntityType entityType = (EntityType) uniqueKeyType;
      final OgmEntityPersister entityPersister = (OgmEntityPersister) entityType.getAssociatedJoinable( getFactory() );
      gridUniqueKeyType = entityPersister.getGridIdentifierType();
    }
View Full Code Here

    // copied from the superclass constructor
    isInverse = collection.isInverse();
    oneToMany = collection.isOneToMany();
    if ( collection.isOneToMany() && getElementPersister() != null && getElementType().isEntityType() ) {
      associationType = AssociationType.EMBEDDED_FK_TO_ENTITY;
      final Type identifierOrUniqueKeyType = ( (EntityType) getElementType() )
          .getIdentifierOrUniqueKeyType( factory );
      gridTypeOfAssociatedId = typeTranslator.getType( identifierOrUniqueKeyType );
    }
    else if ( collection.isOneToMany() ) {
      // one to many but not what we expected
      throw new AssertionFailure( "Association marked as one to many but has no ManyToOneType: " + collection.getRole() );
    }
    else if ( getElementType().isAssociationType() && getElementType().isEntityType() ) {
      associationType = AssociationType.ASSOCIATION_TABLE_TO_ENTITY;
      final Type identifierOrUniqueKeyType = ( (EntityType) getElementType() ).getIdentifierOrUniqueKeyType( factory );
      gridTypeOfAssociatedId = typeTranslator.getType( identifierOrUniqueKeyType );
    }
    else {
      gridTypeOfAssociatedId = null;
      associationType = AssociationType.OTHER;
View Full Code Here

    final EntityMetamodel entityMetamodel = persister.getEntityMetamodel();
    final boolean[] uniqueness = persister.getPropertyUniqueness();
    final Type[] propertyTypes = persister.getPropertyTypes();
    for ( int propertyIndex = 0; propertyIndex < entityMetamodel.getPropertySpan(); propertyIndex++ ) {
      if ( persister.isPropertyOfTable( propertyIndex, tableIndex ) ) {
        final Type propertyType = propertyTypes[propertyIndex];
        boolean isStarToOne = propertyType.isAssociationType() && ! propertyType.isCollectionType();
        final boolean createMetadata = isStarToOne || uniqueness[propertyIndex];
        if ( removePropertyMetadata && createMetadata ) {
          //remove from property cache
          Object[] oldColumnValues = LogicalPhysicalConverterHelper.getColumnValuesFromResultset(
              resultset,
View Full Code Here

TOP

Related Classes of org.hibernate.type.Type

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.