Package org.hibernate.type

Examples of org.hibernate.type.EntityType


    for ( Type queryReturn : queryReturnTypes ) {
      if ( queryReturn instanceof EntityType ) {
        if ( metadata != null ) {
          return null;
        }
        EntityType rootReturn = (EntityType) queryReturn;
        OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( rootReturn.getName() );
        metadata = new EntityKeyMetadata( persister.getTableName(), persister.getRootTableIdentifierColumnNames() );
      }
    }

    return metadata;
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();
    }
    else {
      throw new AssertionFailure( "loadByUniqueKey on a non EntityType:" + propertyName );
    }
View Full Code Here

    for ( Type queryReturn : queryReturnTypes ) {
      if ( queryReturn instanceof EntityType ) {
        if ( metadata != null ) {
          return null;
        }
        EntityType rootReturn = (EntityType) queryReturn;
        OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( rootReturn.getName() );
        metadata = new EntityKeyMetadata( persister.getTableName(), persister.getRootTableIdentifierColumnNames() );
      }
    }

    return metadata;
View Full Code Here

      }
      // We have a to-one on the main side
      else if ( propertyType != null ) {
        associationKind = propertyType.isEntityType() ? AssociationKind.ASSOCIATION : AssociationKind.EMBEDDED_COLLECTION;
        if ( propertyType instanceof EntityType ) {
          EntityType entityType = (EntityType) propertyType;
          OgmEntityPersister associatedPersister = (OgmEntityPersister) entityType.getAssociatedJoinable( session.getFactory() );
          EntityKey entityKey = new EntityKey(
              associatedPersister.getEntityKeyMetadata(),
              columnValues
          );
          ownerEntityKey = entityKey;
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();
    }
    else {
      throw new AssertionFailure( "loadByUniqueKey on a non EntityType:" + propertyName );
    }
View Full Code Here

    throws HibernateException {
      if ( value == null ) {
        return null;
      }
      else if ( type.isEntityType() ) {
        EntityType entityType = (EntityType) type;
        if ( entityType.isOneToOne() ) {
          return value;
        }
        else {
          String entityName = entityType.getAssociatedEntityName();
          return isNullifiable(entityName, value) ? null : value;
        }
      }
      else if ( type.isAnyType() ) {
        return isNullifiable(null, value) ? null : value;
View Full Code Here

      String role = ownerPersister.getEntityName() + '.' + fetchReturn.getOwnerProperty();
      addCollection( role, alias, fetchReturn.getPropertyResultsMap() );
//      collectionOwnerAliases.add( ownerAlias );
    }
    else if ( returnType.isEntityType() ) {
      EntityType eType = ( EntityType ) returnType;
      String returnEntityName = eType.getAssociatedEntityName();
      SQLLoadable persister = getSQLLoadable( returnEntityName );
      addPersister( alias, fetchReturn.getPropertyResultsMap(), persister );
    }

  }
View Full Code Here

      if ( element.isFetch() ) {
        if ( element.isCollectionJoin() || element.getQueryableCollection() != null ) {
          // This is now handled earlier in this method.
        }
        else if ( element.getDataType().isEntityType() ) {
          EntityType entityType = ( EntityType ) element.getDataType();
          if ( entityType.isOneToOne() ) {
            owners[i] = fromElementList.indexOf( element.getOrigin() );
          }
          ownerAssociationTypes[i] = entityType;
        }
      }
View Full Code Here

        throw new QueryException( me );
      }
    }
    join.addCondition( collectionName, keyColumnNames, " = ?" );
    //if ( persister.hasWhere() ) join.addCondition( persister.getSQLWhereString(collectionName) );
    EntityType elemType = ( EntityType ) collectionElementType;
    addFrom( elementName, elemType.getAssociatedEntityName(), join );

  }
View Full Code Here

          final EmbeddedComponentType dependentIdType =
              (EmbeddedComponentType) persister.getEntityMetamodel().getIdentifierProperty().getType();
          if ( dependentIdType.getSubtypes().length == 1 ) {
            final Type singleSubType = dependentIdType.getSubtypes()[0];
            if ( singleSubType.isEntityType() ) {
              final EntityType dependentParentType = (EntityType) singleSubType;
              final Type dependentParentIdType = dependentParentType.getIdentifierOrUniqueKeyType( source.getFactory() );
              if ( dependentParentIdType.getReturnedClass().isInstance( event.getEntityId() ) ) {
                // yep that's what we have...
                loadByDerivedIdentitySimplePkValue(
                    event,
                    loadType,
                    persister,
                    dependentIdType,
                    source.getFactory().getEntityPersister( dependentParentType.getAssociatedEntityName() )
                );
                return;
              }
            }
          }
View Full Code Here

TOP

Related Classes of org.hibernate.type.EntityType

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.