Incorrect SQL for JPQL query selecting Map value from an elementCollection of a
Map and the map the value is an embeddable
--------------------------------------------------------------------------------------------------------------------------
Key: OPENJPA-1283
URL: https://issues.apache.org/jira/browse/OPENJPA-1283
Project: OpenJPA
Issue Type: Bug
Affects Versions: 2.0.0
Reporter: Catalina Wei
Assignee: Catalina Wei
Fix For: 2.0.0
SELECT VALUE(f) FROM Policy p, IN (p.funds) f WHERE f.fundName = :fName and
p.annuityHolderId = :holderId
Where Policy has an ElementCollection as a Map:
@ElementCollection(targetClass = Fund.class, fetch=FetchType.EAGER)
@CollectionTable(name="POLICY_FUNDS",joincolumn...@joincolumn(name="FK_POLICY_ID")})
@MapKeyColumn(name = "FUND_ID")
public Map<Integer, IFund> getFunds() {
return Funds;
}
The generated SQL was incorrect:
SELECT t2.id FROM INSPOLICY t0
INNER JOIN POLICY_FUNDS t1 ON t0.id = t1.FK_POLICY_ID,
INSPOLICY t2
WHERE (t1.fundName = ? AND t0.FK_ANNUITY_HOLDER_ID = ?)
The correct SQL should projecting out t1.*.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.