Package org.hibernate.persister.entity

Examples of org.hibernate.persister.entity.EntityPersister


          boolean fetchFlag,
          boolean inFrom,
          EntityType type) throws SemanticException {
    FromElement elem = createJoin( entityClass, tableAlias, joinSequence, type, false );
    elem.setFetch( fetchFlag );
    EntityPersister entityPersister = elem.getEntityPersister();
    int numberOfTables = entityPersister.getQuerySpaces().length;
    if ( numberOfTables > 1 && implied && !elem.useFromFragment() ) {
      if ( log.isDebugEnabled() ) {
        log.debug( "createEntityJoin() : Implied multi-table entity join" );
      }
      elem.setUseFromFragment( true );
View Full Code Here


      p.getCacheAccessStrategy().evict( cacheKey );
    }
  }

  public void evictEntity(String entityName) throws HibernateException {
    EntityPersister p = getEntityPersister( entityName );
    if ( p.hasCache() ) {
      if ( log.isDebugEnabled() ) {
        log.debug( "evicting second-level cache: " + p.getEntityName() );
      }
      p.getCacheAccessStrategy().evictAll();
    }
  }
View Full Code Here

    }
    this.queryableCollection = queryableCollection;
    SessionFactoryHelper sfh = fromClause.getSessionFactoryHelper();
    FromElement destination = null;
    String tableAlias = null;
    EntityPersister entityPersister = queryableCollection.getElementPersister();
    tableAlias = fromClause.getAliasGenerator().createName( entityPersister.getEntityName() );
    String associatedEntityName = entityPersister.getEntityName();
    EntityPersister targetEntityPersister = sfh.requireClassPersister( associatedEntityName );
    // Create the FROM element for the target (the elements of the collection).
    destination = createAndAddFromElement(
        associatedEntityName,
        classAlias,
        targetEntityPersister,
View Full Code Here

          String tableAlias,
          JoinSequence joinSequence,
          EntityType type,
          boolean manyToMany) throws SemanticException {
    //  origin, path, implied, columns, classAlias,
    EntityPersister entityPersister = fromClause.getSessionFactoryHelper().requireClassPersister( entityClass );
    FromElement destination = createAndAddFromElement( entityClass,
        classAlias,
        entityPersister,
        type,
        tableAlias );
View Full Code Here

      p.getCacheAccessStrategy().evictAll();
    }
  }

  public void evict(Class persistentClass, Serializable id) throws HibernateException {
    EntityPersister p = getEntityPersister( persistentClass.getName() );
    if ( p.hasCache() ) {
      if ( log.isDebugEnabled() ) {
        log.debug( "evicting second-level cache: " + MessageHelper.infoString(p, id, this) );
      }
      CacheKey cacheKey = new CacheKey( id, p.getIdentifierType(), p.getRootEntityName(), EntityMode.POJO, this );
      p.getCacheAccessStrategy().evict( cacheKey );
    }
  }
View Full Code Here

      p.getCacheAccessStrategy().evict( cacheKey );
    }
  }

  public void evict(Class persistentClass) throws HibernateException {
    EntityPersister p = getEntityPersister( persistentClass.getName() );
    if ( p.hasCache() ) {
      if ( log.isDebugEnabled() ) {
        log.debug( "evicting second-level cache: " + p.getEntityName() );
      }
      p.getCacheAccessStrategy().evictAll();
    }
  }
View Full Code Here

      elem.setText("");
      elem.setUseWhereFragment(false);
    }

    if ( !implicitJoin ) {
      EntityPersister entityPersister = elem.getEntityPersister();
      if ( entityPersister != null ) {
        getWalker().addQuerySpaces( entityPersister.getQuerySpaces() );
      }
    }
    getWalker().addQuerySpaces( queryableCollection.getCollectionSpaces() )// Always add the collection's query spaces.
  }
View Full Code Here

   * @param owningType The type represeting the entity "owning" the property
   * @return True if propertyName references the entity's (owningType->associatedEntity)
   * primary key; false otherwise.
   */
  private boolean isReferenceToPrimaryKey(String propertyName, EntityType owningType) {
    EntityPersister persister = getSessionFactoryHelper()
        .getFactory()
        .getEntityPersister( owningType.getAssociatedEntityName() );
    if ( persister.getEntityMetamodel().hasNonIdentifierPropertyNamedId() ) {
      // only the identifier property field name can be a reference to the associated entity's PK...
      return propertyName.equals( persister.getIdentifierPropertyName() ) && owningType.isReferenceToPrimaryKey();
    }
    else {
      // here, we have two possibilities:
      //     1) the property-name matches the explicitly identifier property name
      //    2) the property-name matches the implicit 'id' property name
View Full Code Here

   */
  public void onLoad(LoadEvent event, LoadEventListener.LoadType loadType) throws HibernateException {

    final SessionImplementor source = event.getSession();

    EntityPersister persister;
    if ( event.getInstanceToLoad() != null ) {
      persister = source.getEntityPersister( null, event.getInstanceToLoad() ); //the load() which takes an entity does not pass an entityName
      event.setEntityClassName( event.getInstanceToLoad().getClass().getName() );
    }
    else {
      persister = source.getFactory().getEntityPersister( event.getEntityClassName() );
    }

    if ( persister == null ) {
      throw new HibernateException(
          "Unable to locate persister: " +
          event.getEntityClassName()
        );
    }

    if ( persister.getIdentifierType().isComponentType() && EntityMode.DOM4J == event.getSession().getEntityMode() ) {
      // skip this check for composite-ids relating to dom4j entity-mode;
      // alternatively, we could add a check to make sure the incoming id value is
      // an instance of Element...
    }
    else {
      Class idClass = persister.getIdentifierType().getReturnedClass();
      if ( idClass != null && ! idClass.isInstance( event.getEntityId() ) ) {
        throw new TypeMismatchException(
            "Provided id of the wrong type. Expected: " + idClass + ", got " + event.getEntityId().getClass()
        );
      }
View Full Code Here

        if ( status == Status.DELETED || status == Status.GONE ) {
          return REMOVED_ENTITY_MARKER;
        }
      }
      if ( options.isAllowNulls() ) {
        EntityPersister persister = event.getSession().getFactory().getEntityPersister( event.getEntityClassName() );
        if ( ! persister.isInstance( old, event.getSession().getEntityMode() ) ) {
          return INCONSISTENT_RTN_CLASS_MARKER;
        }
      }
      upgradeLock( old, oldEntry, event.getLockMode(), session );
    }
View Full Code Here

TOP

Related Classes of org.hibernate.persister.entity.EntityPersister

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.