Package org.hibernate

Examples of org.hibernate.WrongClassException


    final Object object,
    final LockMode lockMode,
    final SessionImplementor session)
  throws HibernateException {
    if ( !persister.isInstance( object ) ) {
      throw new WrongClassException(
          "loaded object was of wrong class " + object.getClass(),
          key.getIdentifier(),
          persister.getEntityName()
        );
    }
View Full Code Here


          final LockMode lockMode,
          final SessionImplementor session)
  throws HibernateException, SQLException {

    if ( !persister.isInstance( object, session.getEntityMode() ) ) {
      throw new WrongClassException(
          "loaded object was of wrong class " + object.getClass(),
          key.getIdentifier(),
          persister.getEntityName()
        );
    }
View Full Code Here

      final String result = persister.getSubclassForDiscriminatorValue( discriminatorValue );

      if ( result == null ) {
        //woops we got an instance of another class hierarchy branch
        throw new WrongClassException(
            "Discriminator: " + discriminatorValue,
            id,
            persister.getEntityName()
          );
      }
View Full Code Here

      final Object target = source.getPersistenceContext().unproxy(result);
      if ( target == entity ) {
        throw new AssertionFailure("entity was not detached");
      }
      else if ( !source.getEntityName(target).equals(entityName) ) {
        throw new WrongClassException(
            "class of the given object did not match class of persistent copy",
            event.getRequestedId(),
            entityName
          );
      }
View Full Code Here

      final Object target = source.getPersistenceContext().unproxy(result);
      if ( target == entity ) {
        throw new AssertionFailure("entity was not detached");
      }
      else if ( !source.getEntityName(target).equals(entityName) ) {
        throw new WrongClassException(
            "class of the given object did not match class of persistent copy",
            event.getRequestedId(),
            entityName
          );
      }
View Full Code Here

          final LockMode lockMode,
          final SessionImplementor session)
  throws HibernateException, SQLException {

    if ( !persister.isInstance( object, session.getEntityMode() ) ) {
      throw new WrongClassException(
          "loaded object was of wrong class " + object.getClass(),
          key.getIdentifier(),
          persister.getEntityName()
        );
    }
View Full Code Here

      final String result = persister.getSubclassForDiscriminatorValue( discriminatorValue );

      if ( result == null ) {
        //woops we got an instance of another class hierarchy branch
        throw new WrongClassException(
            "Discriminator: " + discriminatorValue,
            id,
            persister.getEntityName()
          );
      }
View Full Code Here

      final Object object,
      final LockMode requestedLockMode,
      final SessionImplementor session)
      throws HibernateException, SQLException {
    if ( !persister.isInstance( object ) ) {
      throw new WrongClassException(
          "loaded object was of wrong class " + object.getClass(),
          key.getIdentifier(),
          persister.getEntityName()
      );
    }
View Full Code Here

      final String result = persister.getSubclassForDiscriminatorValue( discriminatorValue );

      if ( result == null ) {
        //woops we got an instance of another class hierarchy branch
        throw new WrongClassException(
            "Discriminator: " + discriminatorValue,
            id,
            persister.getEntityName()
          );
      }
View Full Code Here

    // see if we have an existing entry in the session for this EntityKey
    final Object existing = context.getSession().getEntityUsingInterceptor( entityKey );
    if ( existing != null ) {
      // It is previously associated with the Session, perform some checks
      if ( ! entityReference.getEntityPersister().isInstance( existing ) ) {
        throw new WrongClassException(
            "loaded object was of wrong class " + existing.getClass(),
            entityKey.getIdentifier(),
            entityReference.getEntityPersister().getEntityName()
        );
      }
View Full Code Here

TOP

Related Classes of org.hibernate.WrongClassException

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.