You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Michael Glauche (JIRA)" <ji...@apache.org> on 2013/01/14 11:54:13 UTC
[jira] [Updated] (OPENJPA-2303) second call of getSingleResult()
fails with @EagerFetchMode(FetchMode.JOIN)
[ https://issues.apache.org/jira/browse/OPENJPA-2303?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Glauche updated OPENJPA-2303:
-------------------------------------
Priority: Critical (was: Major)
> 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.0, 2.2.1
> Reporter: Michael Glauche
> Priority: Critical
> Attachments: jpaTest.zip
>
>
> 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