Package org.hibernate.type

Examples of org.hibernate.type.EntityType


        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


  private void determineKeySelectExpressions(QueryableCollection collectionPersister, List selections) {
    AliasGenerator aliasGenerator = new LocalAliasGenerator( 0 );
    appendSelectExpressions( collectionPersister.getIndexColumnNames(), selections, aliasGenerator );
    Type keyType = collectionPersister.getIndexType();
    if ( keyType.isAssociationType() ) {
      EntityType entityType = (EntityType) keyType;
      Queryable keyEntityPersister = ( Queryable ) sfi().getEntityPersister(
          entityType.getAssociatedEntityName( sfi() )
      );
      SelectFragment fragment = keyEntityPersister.propertySelectFragmentFragment(
          collectionTableAlias(),
          null,
          false
View Full Code Here

  private void determineValueSelectExpressions(QueryableCollection collectionPersister, List selections) {
    AliasGenerator aliasGenerator = new LocalAliasGenerator( 1 );
    appendSelectExpressions( collectionPersister.getElementColumnNames(), selections, aliasGenerator );
    Type valueType = collectionPersister.getElementType();
    if ( valueType.isAssociationType() ) {
      EntityType valueEntityType = (EntityType) valueType;
      Queryable valueEntityPersister = ( Queryable ) sfi().getEntityPersister(
          valueEntityType.getAssociatedEntityName( sfi() )
      );
      SelectFragment fragment = valueEntityPersister.propertySelectFragmentFragment(
          elementTableAlias(),
          null,
          false
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

      if (config==FetchMode.JOIN) return true;
      if (config==FetchMode.SELECT) return false;
      if ( type.isEntityType() ) {
        //TODO: look at the owning property and check that it
        //      isn't lazy (by instrumentation)
        EntityType entityType =(EntityType) type;
        EntityPersister persister = getFactory().getEntityPersister( entityType.getAssociatedEntityName() );
        return !persister.hasProxy();
      }
      else {
        return false;
      }
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

        NonScalarReturn ownerDescriptor = fetchRtn.getOwner();
        int ownerIndex = nonScalarReturnList.indexOf( ownerDescriptor );
        entityOwners.add( new Integer( ownerIndex ) );
        lockModes.add( fetchRtn.getLockMode() );
        Queryable ownerPersister = determineAppropriateOwnerPersister( ownerDescriptor );
        EntityType fetchedType = ( EntityType ) ownerPersister.getPropertyType( fetchRtn.getOwnerProperty() );
        String entityName = fetchedType.getAssociatedEntityName( getFactory() );
        Queryable persister = ( Queryable ) factory.getEntityPersister( entityName );
        entityPersisters.add( persister );
        nonScalarReturnList.add( rtn );
        specifiedAliases.add( fetchRtn.getAlias() );
        entityAliases.add( fetchRtn.getEntityAliases() );
View Full Code Here

    }
    else if ( ownerDescriptor instanceof CollectionReturn ) {
      CollectionReturn collRtn = ( CollectionReturn ) ownerDescriptor;
      String role = collRtn.getOwnerEntityName() + "." + collRtn.getOwnerProperty();
      CollectionPersister persister = getFactory().getCollectionPersister( role );
      EntityType ownerType = ( EntityType ) persister.getElementType();
      entityName = ownerType.getAssociatedEntityName( getFactory() );
    }
    else if ( ownerDescriptor instanceof FetchReturn ) {
      FetchReturn fetchRtn = ( FetchReturn ) ownerDescriptor;
      Queryable persister = determineAppropriateOwnerPersister( fetchRtn.getOwner() );
      Type ownerType = persister.getPropertyType( fetchRtn.getOwnerProperty() );
      if ( ownerType.isEntityType() ) {
        entityName = ( ( EntityType ) ownerType ).getAssociatedEntityName( getFactory() );
      }
      else if ( ownerType.isCollectionType() ) {
        Type ownerCollectionElementType = ( ( CollectionType ) ownerType ).getElementType( getFactory() );
        if ( ownerCollectionElementType.isEntityType() ) {
          entityName = ( ( EntityType ) ownerCollectionElementType ).getAssociatedEntityName( getFactory() );
        }
      }
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

      if (config==FetchMode.JOIN) return true;
      if (config==FetchMode.SELECT) return false;
      if ( type.isEntityType() ) {
        //TODO: look at the owning property and check that it
        //      isn't lazy (by instrumentation)
        EntityType entityType =(EntityType) type;
        EntityPersister persister = getFactory().getEntityPersister( entityType.getAssociatedEntityName() );
        return !persister.hasProxy();
      }
      else {
        return false;
      }
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.