Package org.hibernate

Examples of org.hibernate.WrongClassException


          final Object object,
          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 object,
          final LockMode lockMode,
          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

      assertEquals(TestBean.class.getName(), ex.getPersistentClassName());
      assertEquals("id", ex.getIdentifier());
      assertEquals(onfe, ex.getCause());
    }

    final WrongClassException wcex = new WrongClassException("msg", "id", TestBean.class.getName());
    try {
      createTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(org.hibernate.Session session) throws HibernateException {
          throw wcex;
        }
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 object,
          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

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.