lets follow..
- comment out the exception in the unsuccessfulSingleResultTooManyEntries test case of QueriesTest.. thus, it will pass..
@Test// (expected = NonUniqueResultException.class)
public void unsuccessfulSingleResultTooManyEntries() {
insertPerson();
insertPerson();
// This will fail because we expect a single result
// but in fact there are 2 results returned.
em.createQuery("from Person").getSingleResult();
}
this is because, getSingleResult() does not get angry when there are more than one records and just picks the first one..
Hiç yorum yok:
Yorum Gönder