Hi,
This is from the definition of a named query:
query = "SELECT o from AssessmentImpl o "
+ "left join fetch o.assessmentResults "
+ "where "
+ "o.assessmentKey.dateCreated >
:outstandingLimit "
+ "and o.pollResultsAttempts < :pollCountLimit "
+ "and ("
+ " o.resultsAvailable = true "
+ " or o.status = AssessmentStatus.Pending "
+ " or o.status = AssessmentStatus.InProgress "
+ ")")
The assessmentResults field is a OneToMany join, usually fetched lazily.
For the purposes of this query I want to pull in all the
assessmentResults so I want it eagerly and I added the "left join fetch"
line.
Unfortunately this adds a DISTINCT to the SQL query and fails because
one of the columns is a LOB.
Why does adding "left fetch join" make it DISTINCT?
And is there any way to avoid it?
Thanks.
Jim