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(AbstractQueryImpl.java:820) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811) at com.gwtech.crm.action.TestUniqueResult.main(TestUniqueResult.java:18)
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.
No comments:
Post a Comment