I have an entity with a map collection, and I'm trying to select a list of
these entities with an eager fetch for the map collection.
I read about OpenJPA's Eager Fetch Modes NONE, PARALLEL and JOIN, and I've
experimented with various global or per-query settings, but I'm always
getting the NONE behaviour with 1+n selects, instead of the expected 1+1
selects for PARALLEL or a single select for JOIN.
Could it be that the JOIN mode is not yet supported for maps (I'm using
OpenJPA 2.0.1)? Or am I overlooking anything?
Here is my entity:
@Entity
class OsmNode
{
@Id
private long id;
private int longitude;
private int latitude;
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "k")
@Column(name = "v")
@CollectionTable(name = "node_tags", joinColumns = @JoinColumn(name =
"id"))
private Map<String, String> tags;
}
The JPQL query is
select n from OsmNode n join fetch n.tags
and even with openjpa.jdbc.EagerFetchMode=join, I'm getting the following
1+n SQL selects:
SELECT t0.id, t0.latitude, t0.longitude FROM osm.nodes t0
SELECT t0.k, t0.v FROM osm.node_tags t0 WHERE t0.id = ?
TIA for any help!
Best regards,
Harald
--
View this message in context:
http://openjpa.208410.n2.nabble.com/Eager-fetch-problem-with-map-collections-tp5533830p5533830.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.