openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Stultz <>
Subject Non-unique error
Date Tue, 12 Jan 2010 18:59:44 GMT

I'm hoping someone can tell me how this could happen:

<openjpa-1.2.1-r752877:753278 nonfatal user error>
The query on candidate type "class ...model.User"
with filter
"select distinct o from User as o
left join fetch o.validRoles
left join fetch o.excludedConsultants
left join fetch o.excludedPatientConsiderations
left join fetch o.excludedProcedures where = :id"
was configured to have a unique result, but more than one instance matched
the query.
        at org.apache.openjpa.kernel.QueryImpl.toResult(
        at org.apache.openjpa.kernel.QueryImpl.execute(
        at org.apache.openjpa.kernel.QueryImpl.execute(
        at org.apache.openjpa.kernel.QueryImpl.execute(

When run in isolation in test app it works fine. My real usage is that I'm
trying to "load deep" the user. So I have a detached user instance and I'm
reloading the user fetching the various collections. It's possible the user
instance is in the L1 cache. Perhaps OpenJPA is including the cached user
instance in the results. I know there are bugs related to left join and
distinct but I'm not sure if this is a variation of it.

Everything works fine if I use fetch plan to load the collections (which I
prefer) but I'm generally afraid of this due to bug [1].


Daryl Stultz
6 Degrees Software and Consulting, Inc.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message