Package org.hibernate

Examples of org.hibernate.TransientObjectException


          String transientEntityName = event.getSession().guessEntityName( transientEntity );
          transientEntityNames.add( transientEntityName );
          log.trace( "transient instance could not be processed by merge: " +
              transientEntityName + "[" + transientEntity + "]" );
        }
        throw new TransientObjectException(
          "one or more objects is an unsaved transient instance - save transient instance(s) before merging: " +
          transientEntityNames );
      }
    }
    copyCache.clear();
View Full Code Here


      if ( copyEntry == null ) {
        // entity name will not be available for non-POJO entities
        // TODO: cache the entity name somewhere so that it is available to this exception
        log.trace( "transient instance could not be processed by merge: " +
            event.getSession().guessEntityName( copy ) + "[" + entity + "]" );
        throw new TransientObjectException(
          "object is an unsaved transient instance - save the transient instance before merging: " +
            event.getSession().guessEntityName( copy )
        );
      }
      else if ( copyEntry.getStatus() == Status.SAVING ) {
View Full Code Here

  }

  public void setReadOnly(Object entity, boolean readOnly) {
    EntityEntry entry = getEntry(entity);
    if (entry==null) {
      throw new TransientObjectException("Instance was not associated with the session");
    }
    entry.setReadOnly(readOnly, entity);
    hasNonReadOnlyEntities = hasNonReadOnlyEntities || !readOnly;
  }
View Full Code Here

  }

  public void setReadOnly(Object entity, boolean readOnly) {
    EntityEntry entry = getEntry(entity);
    if (entry==null) {
      throw new TransientObjectException("Instance was not associated with the session");
    }
    entry.setReadOnly(readOnly, entity);
    hasNonReadOnlyEntities = hasNonReadOnlyEntities || !readOnly;
  }
View Full Code Here

      if ( entity instanceof HibernateProxy ) {
        entity = ( (HibernateProxy) entity ).getHibernateLazyInitializer().getImplementation();
      }
      EntityEntry entry = event.getSession().getPersistenceContext().getEntry( entity );
      if ( entry == null ) {
        throw new TransientObjectException(
            "object references an unsaved transient instance - save the transient instance before merging: " +
            event.getSession().guessEntityName( entity )
        );
        // TODO: cache the entity name somewhere so that it is available to this exception
        // entity name will not be available for non-POJO entities
View Full Code Here

    EntityEntry entry = source.getPersistenceContext().getEntry(entity);
    if (entry==null) {
      final EntityPersister persister = source.getEntityPersister( event.getEntityName(), entity );
      final Serializable id = persister.getIdentifier( entity, source.getEntityMode() );
      if ( !ForeignKeys.isNotTransient( event.getEntityName(), entity, Boolean.FALSE, source ) ) {
        throw new TransientObjectException(
            "cannot lock an unsaved transient instance: " +
            persister.getEntityName()
        );
      }
View Full Code Here

    // use the id assigned to the instance
    Serializable id = persister.getIdentifier( entity, entityMode );
    if ( id == null ) {
      // assume this is a newly instantiated transient object
      // which should be saved rather than updated
      throw new TransientObjectException(
          "The given object has a null identifier: " +
              persister.getEntityName()
      );
    }
    else {
View Full Code Here

      }

      id = persister.getIdentifier( entity, source.getEntityMode() );

      if ( id == null ) {
        throw new TransientObjectException(
            "the detached instance passed to delete() had a null identifier"
        );
      }

      EntityKey key = new EntityKey( id, persister, source.getEntityMode() );
View Full Code Here

  }

  public void setReadOnly(Object entity, boolean readOnly) {
    EntityEntry entry = getEntry(entity);
    if (entry==null) {
      throw new TransientObjectException("Instance was not associated with the session");
    }
    entry.setReadOnly(readOnly, entity);
    hasNonReadOnlyEntities = hasNonReadOnlyEntities || !readOnly;
  }
View Full Code Here

        return LockMode.NONE;
      }
    }
    EntityEntry e = persistenceContext.getEntry(object);
    if ( e == null ) {
      throw new TransientObjectException( "Given object not associated with the session" );
    }
    if ( e.getStatus() != Status.MANAGED ) {
      throw new ObjectDeletedException(
          "The given object was deleted",
          e.getId(),
View Full Code Here

TOP

Related Classes of org.hibernate.TransientObjectException

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.