openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Glauche (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2303) second call of getSingleResult() fails with @EagerFetchMode(FetchMode.JOIN)
Date Mon, 10 Dec 2012 14:21:21 GMT
Michael Glauche created OPENJPA-2303:
----------------------------------------

             Summary: second call of getSingleResult() fails with @EagerFetchMode(FetchMode.JOIN)
                 Key: OPENJPA-2303
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2303
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.2.1, 2.2.0
            Reporter: Michael Glauche


When an entity with a field like this:

 	@OneToMany(mappedBy="parent", fetch=FetchType.EAGER)
	@EagerFetchMode(FetchMode.JOIN)

is loaded with getSingleResult() for the second time, an Exception is thrown:

javax.persistence.NonUniqueResultException: Query "select A from EntityA A where A.id=1" selected
3 results, but expected unique result.

When i remove the @EagerFetchMode annotation everything works fine (but then n+1 selects are
fired to load EntityA)

See attached Test Project.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message