Package org.hibernate

Examples of org.hibernate.ObjectNotFoundException


            entityNotFoundDelegate = cfg.getEntityNotFoundDelegate();
          }
          else {
            entityNotFoundDelegate = new EntityNotFoundDelegate() {
              public void handleEntityNotFound(String entityName, Serializable id) {
                throw new ObjectNotFoundException( id, entityName );
              }
            };
          }
        }
        return entityNotFoundDelegate;
View Full Code Here


            entityNotFoundDelegate = cfg.getEntityNotFoundDelegate();
          }
          else {
            entityNotFoundDelegate = new EntityNotFoundDelegate() {
              public void handleEntityNotFound(String entityName, Serializable id) {
                throw new ObjectNotFoundException( id, entityName );
              }
            };
          }
        }
        return entityNotFoundDelegate;
View Full Code Here

    assertTrue("Correct result", result == tb);
  }

  @Test
  public void testLoadWithNotFound()  {
    ObjectNotFoundException onfex = new ObjectNotFoundException("id", TestBean.class.getName());
    given(session.load(TestBean.class, "id")).willThrow(onfex);
    try {
      hibernateTemplate.load(TestBean.class, "id");
      fail("Should have thrown HibernateObjectRetrievalFailureException");
    }
View Full Code Here

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

    final ObjectNotFoundException onfe = new ObjectNotFoundException("id", TestBean.class.getName());
    try {
      hibernateTemplate.execute(new HibernateCallback<Object>() {
        @Override
        public Object doInHibernate(Session session)  {
          throw onfe;
View Full Code Here

    verify(session).close();
  }

  @Test
  public void testLoadWithNotFound() throws HibernateException {
    ObjectNotFoundException onfex = new ObjectNotFoundException("id", TestBean.class.getName());
    given(session.load(TestBean.class, "id")).willThrow(onfex);
    try {
      hibernateTemplate.load(TestBean.class, "id");
      fail("Should have thrown HibernateObjectRetrievalFailureException");
    }
View Full Code Here

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

    final ObjectNotFoundException onfe = new ObjectNotFoundException("id", TestBean.class.getName());
    try {
      hibernateTemplate.execute(new HibernateCallback<Object>() {
        @Override
        public Object doInHibernate(org.hibernate.Session session) throws HibernateException {
          throw onfe;
View Full Code Here

            entityNotFoundDelegate = cfg.getEntityNotFoundDelegate();
          }
          else {
            entityNotFoundDelegate = new EntityNotFoundDelegate() {
              public void handleEntityNotFound(String entityName, Serializable id) {
                throw new ObjectNotFoundException( id, entityName );
              }
            };
          }
        }
        return entityNotFoundDelegate;
View Full Code Here

            entityNotFoundDelegate = cfg.getEntityNotFoundDelegate();
          }
          else {
            entityNotFoundDelegate = new EntityNotFoundDelegate() {
              public void handleEntityNotFound(String entityName, Serializable id) {
                throw new ObjectNotFoundException( id, entityName );
              }
            };
          }
        }
        return entityNotFoundDelegate;
View Full Code Here

            entityNotFoundDelegate = cfg.getEntityNotFoundDelegate();
          }
          else {
            entityNotFoundDelegate = new EntityNotFoundDelegate() {
              public void handleEntityNotFound(String entityName, Serializable id) {
                throw new ObjectNotFoundException( id, entityName );
              }
            };
          }
        }
        return entityNotFoundDelegate;
View Full Code Here

    // EntityNotFoundDelegate
    EntityNotFoundDelegate entityNotFoundDelegate = cfg.getEntityNotFoundDelegate();
    if ( entityNotFoundDelegate == null ) {
      entityNotFoundDelegate = new EntityNotFoundDelegate() {
        public void handleEntityNotFound(String entityName, Serializable id) {
          throw new ObjectNotFoundException( id, entityName );
        }
      };
    }
    this.entityNotFoundDelegate = entityNotFoundDelegate;
View Full Code Here

TOP

Related Classes of org.hibernate.ObjectNotFoundException

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.