Package org.hibernate.engine.spi

Examples of org.hibernate.engine.spi.SessionImplementor.generateEntityKey()


  }

  private Object getReplacement() {
    final SessionImplementor session = getSession();
    if ( isUninitialized() && session != null && session.isOpen()) {
      final EntityKey key = session.generateEntityKey(
          getIdentifier(),
          session.getFactory().getEntityPersister( getEntityName() )
      );
      final Object entity = session.getPersistenceContext().getEntity(key);
      if (entity!=null) setImplementation( entity );
View Full Code Here


      }
      //need to do that here rather than in the save event listener to let
      //the post insert events to have a id-filled entity when IDENTITY is used (EJB3)
      persister.setIdentifier( instance, generatedId, session );
      session.getPersistenceContext().registerInsertedKey( getPersister(), generatedId );
      entityKey = session.generateEntityKey( generatedId, persister );
      session.getPersistenceContext().checkUniqueness( entityKey, getInstance() );
    }


    //TODO: this bit actually has to be called after all cascades!
View Full Code Here

          "Provided id of the wrong type for class " + persister.getEntityName() + ". Expected: " + idClass
              + ", got " + event.getEntityId().getClass()
      );
    }

    final EntityKey keyToLoad = source.generateEntityKey( event.getEntityId(), persister );

    try {
      if ( loadType.isNakedEntityReturned() ) {
        //do not return a proxy!
        //(this option indicates we are initializing a proxy)
View Full Code Here

  }

  private Object getReplacement() {
    final SessionImplementor session = getSession();
    if ( isUninitialized() && session != null && session.isOpen()) {
      final EntityKey key = session.generateEntityKey(
          getIdentifier(),
          session.getFactory().getEntityPersister( getEntityName() )
      );
      final Object entity = session.getPersistenceContext().getEntity(key);
      if (entity!=null) setImplementation( entity );
View Full Code Here

      throw new TypeMismatchException(
          "Provided id of the wrong type for class " + persister.getEntityName() + ". Expected: " + idClass + ", got " + event.getEntityId().getClass()
      );
    }

    final  EntityKey keyToLoad = source.generateEntityKey( event.getEntityId(), persister );

    try {
      if ( loadType.isNakedEntityReturned() ) {
        //do not return a proxy!
        //(this option indicates we are initializing a proxy)
View Full Code Here

      throw new TypeMismatchException(
          "Provided id of the wrong type for class " + persister.getEntityName() + ". Expected: " + idClass + ", got " + event.getEntityId().getClass()
      );
    }

    final  EntityKey keyToLoad = source.generateEntityKey( event.getEntityId(), persister );

    try {
      if ( loadType.isNakedEntityReturned() ) {
        //do not return a proxy!
        //(this option indicates we are initializing a proxy)
View Full Code Here

      throw new TypeMismatchException(
          "Provided id of the wrong type for class " + persister.getEntityName() + ". Expected: " + idClass + ", got " + event.getEntityId().getClass()
      );
    }

    final  EntityKey keyToLoad = source.generateEntityKey( event.getEntityId(), persister );

    try {
      if ( loadType.isNakedEntityReturned() ) {
        //do not return a proxy!
        //(this option indicates we are initializing a proxy)
View Full Code Here

  }

  private Object getReplacement() {
    final SessionImplementor session = getSession();
    if ( isUninitialized() && session != null && session.isOpen()) {
      final EntityKey key = session.generateEntityKey(
          getIdentifier(),
          session.getFactory().getEntityPersister( getEntityName() )
      );
      final Object entity = session.getPersistenceContext().getEntity(key);
      if (entity!=null) setImplementation( entity );
View Full Code Here

    //check the persistence context
    List<EntityInfo> remainingEntityInfos = new ArrayList<EntityInfo>( maxResults );
    for ( EntityInfo entityInfo : entityInfos ) {
      if ( ObjectLoaderHelper.areDocIdAndEntityIdIdentical( entityInfo, session ) ) {
        EntityKey entityKey = sessionImplementor.generateEntityKey( entityInfo.getId(), persister );
        final boolean isInitialized = persistenceContext.containsEntity( entityKey );
        if ( !isInitialized ) {
          remainingEntityInfos.add( entityInfo );
        }
      }
View Full Code Here

      throw new TypeMismatchException(
          "Provided id of the wrong type for class " + persister.getEntityName() + ". Expected: " + idClass + ", got " + event.getEntityId().getClass()
      );
    }

    final  EntityKey keyToLoad = source.generateEntityKey( event.getEntityId(), persister );

    try {
      if ( loadType.isNakedEntityReturned() ) {
        //do not return a proxy!
        //(this option indicates we are initializing a proxy)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.