java.util.concurrent.ExecutionException: org.springframework.dao.IncorrectResultSizeDataAccessException: result returns more than one elements; nested exception is javax.persistence.NonUniqueResultException: result returns more than one elements

Stack Overflow | Felix | 2 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Spring Repository @Async Future<List<T>> returning wrong type

    Stack Overflow | 2 years ago | Felix
    java.util.concurrent.ExecutionException: org.springframework.dao.IncorrectResultSizeDataAccessException: result returns more than one elements; nested exception is javax.persistence.NonUniqueResultException: result returns more than one elements
  2. 0

    Game save error

    GitHub | 4 months ago | magixsource
    org.springframework.dao.IncorrectResultSizeDataAccessException: result returns more than one elements; nested exception is javax.persistence.NonUniqueResultException: result returns more than one elements

Root Cause Analysis

  1. javax.persistence.NonUniqueResultException

    result returns more than one elements

    at org.hibernate.jpa.internal.QueryImpl.getSingleResult()
  2. org.hibernate.jpa
    CriteriaQueryTypeQueryAdapter.getSingleResult
    1. org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:505)
    2. org.hibernate.jpa.criteria.compile.CriteriaQueryTypeQueryAdapter.getSingleResult(CriteriaQueryTypeQueryAdapter.java:71)
    2 frames
  3. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:483)
    4 frames
  4. Spring ORM
    SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke
    1. org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:362)
    1 frame
  5. com.sun.proxy
    $Proxy74.getSingleResult
    1. com.sun.proxy.$Proxy74.getSingleResult(Unknown Source)
    1 frame
  6. Spring Data JPA
    JpaQueryExecution.execute
    1. org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:197)
    2. org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:74)
    2 frames