Package org.hibernate.engine

Examples of org.hibernate.engine.EntityKey


        return snapshot;
      }
    }
    else {
      //TODO: optimize away this lookup for entities w/o unsaved-value="undefined"
      EntityKey entityKey = new EntityKey( id, persister, session.getEntityMode() );
      return session.getPersistenceContext()
          .getCachedDatabaseSnapshot( entityKey );
    }
  }
View Full Code Here


  /**
   * Return the underlying persistent object in the given <tt>Session</tt>, or null,
   * do not initialize the proxy
   */
  public final Object getImplementation(SessionImplementor s) throws HibernateException {
    final EntityKey entityKey = new EntityKey(
        getIdentifier(),
        s.getFactory().getEntityPersister( getEntityName() ),
        s.getEntityMode()
      );
    return s.getPersistenceContext().getEntity( entityKey );
View Full Code Here

                MessageHelper.infoString( persister, id, source.getFactory() )
        );
      }

      final boolean regenerate = persister.isIdentifierAssignedByInsert(); // prefer re-generation of identity!
      final EntityKey key = regenerate ?
          null : new EntityKey( id, persister, source.getEntityMode() );

      performSaveOrReplicate(
          entity,
          key,
          persister,
View Full Code Here

    source.getPersistenceContext().addEntity(
        entity,
        Status.MANAGED,
        null,
        new EntityKey( id, persister, source.getEntityMode() ),
        version,
        LockMode.NONE,
        true,
        persister,
        true,
View Full Code Here

          "saving " +
              MessageHelper.infoString( persister, id, source.getFactory() )
      );
    }

    EntityKey key;
    if ( !useIdentityColumn ) {
      key = new EntityKey( id, persister, source.getEntityMode() );
      Object old = source.getPersistenceContext().getEntity( key );
      if ( old != null ) {
        if ( source.getPersistenceContext().getEntry( old ).getStatus() == Status.DELETED ) {
          source.forceFlush( source.getPersistenceContext().getEntry( old ) );
        }
View Full Code Here

        log.debug( "executing identity-insert immediately" );
        source.getActionQueue().execute( insert );
        id = insert.getGeneratedId();
        //now done in EntityIdentityInsertAction
        //persister.setIdentifier( entity, id, source.getEntityMode() );
        key = new EntityKey( id, persister, source.getEntityMode() );
        source.getPersistenceContext().checkUniqueness( key, entity );
        //source.getBatcher().executeBatch(); //found another way to ensure that all batched joined inserts have been executed
      }
      else {
        log.debug( "delaying identity-insert due to no transaction in progress" );
View Full Code Here

    if ( entry == null ) {
      throw new AssertionFailure( "possible nonthreadsafe access to session" );
    }
    entry.postDelete();

    EntityKey key = new EntityKey( entry.getId(), entry.getPersister(), session.getEntityMode() );
    persistenceContext.removeEntity(key);
    persistenceContext.removeProxy(key);
   
    if ( persister.hasCache() ) persister.getCache().evict(ck);
View Full Code Here

  private synchronized EntityKey generateDelayedEntityKey() {
    if ( !isDelayed ) {
      throw new AssertionFailure( "cannot request delayed entity-key for non-delayed post-insert-id generation" );
    }
    return new EntityKey( new DelayedPostInsertIdentifier(), getPersister(), getSession().getEntityMode() );
  }
View Full Code Here

    errorIfClosed();
    EntityPersister persister = getFactory().getEntityPersister(entityName);
    if ( !eager && persister.hasProxy() ) {
      return persister.createProxy(id, this);
    }
    Object loaded = temporaryPersistenceContext.getEntity( new EntityKey(id, persister, EntityMode.POJO) );
    //TODO: if not loaded, throw an exception
    return loaded==null ? get( entityName, id ) : loaded;
  }
View Full Code Here

      // key value upon which to perform the breaking logic.  However,
      // it is also then called from getRowFromResultSet() which is certainly
      // not the most efficient.  But the call here is needed, and there
      // currently is no other way without refactoring of the doQuery()/getRowFromResultSet()
      // methods
      final EntityKey currentKey = getKeyFromResultSet(
          0,
          getEntityPersisters()[0],
          null,
          resultSet,
          session
View Full Code Here

TOP

Related Classes of org.hibernate.engine.EntityKey

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.