Wednesday, 10 July 2013


if you getting (org.hibernate.NonUniqueResultException)

Exception in thread "main" org.hibernate.NonUniqueResultException: query did not return a unique result: 2
 at org.hibernate.impl.AbstractQueryImpl.uniqueElement(
 at org.hibernate.impl.AbstractQueryImpl.uniqueResult(
 at com.gwtech.crm.action.TestUniqueResult.main(

Reason for this Exception you are accessing a value that is more then one in database. There are some solution to resolve this :-

1. Check your database value(id, name etc) are replicate modify make unique them.
2. if you don't want to change your database use get(0) return 0 index value only.
3. Else you replace uniqueResult() with List() .

Hope This Help You.