Here are the examples of the java api org.hibernate.ObjectNotFoundException taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
17
Source : HibernateTemplateTests.java
with Apache License 2.0
from langtianya
with Apache License 2.0
from langtianya
@Test
public void testLoadWithNotFound() {
ObjectNotFoundException onfex = new ObjectNotFoundException("id", TestBean.clreplaced.getName());
given(session.load(TestBean.clreplaced, "id")).willThrow(onfex);
try {
hibernateTemplate.load(TestBean.clreplaced, "id");
fail("Should have thrown HibernateObjectRetrievalFailureException");
} catch (HibernateObjectRetrievalFailureException ex) {
// expected
replacedertEquals(TestBean.clreplaced.getName(), ex.getPersistentClreplacedName());
replacedertEquals("id", ex.getIdentifier());
replacedertEquals(onfex, ex.getCause());
}
}