[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Map support, querying with expressions using mapKey
|
I have a problem referencing mapKey in queries created using
ExpressionBuilder. Data model:
@Entity
public class MapModel {
private Map<String, MapModel> children;
...
}
Problematic query, ought to select all parent nodes that have a child with
specific key:
builder.anyOf("children").mapKey().equal("someKey")
Transforms to:
SELECT DISTINCT t1.ID FROM MAPMODEL t0, MAPMODEL_MAPMODEL t2, MAPMODEL t1
WHERE ((t0.CHILDREN_KEY = ?) AND ((t2.MapModel_ID = t1.ID) AND (t0.ID =
t2.children_ID)))
bind => [someKey]
... and fails, as column "children_key" is defined in the join table:
"mapmodel_mapmodel", not in "mapmodel" itself.
Everything would work if instead of "(t0.CHILDREN_KEY = ?)" EclipseLink
translated it to "(t2.CHILDREN_KEY = ?)".
Is there something wrong with my Expression usage? Examples say that "get"
should be used rather than "anyOf", but it is actually not possible as it is
a "to-many" mapping.