Note: I can see this is really the case by turning the log level to TRACE.

When using a Map inside an entity (either with a String value or an Entity 
value) I always get N+1 select problems when I select multiple entities. This 
gives inacceptable performance (e.g. we have several hundred products that can 
in theory be easily fetched under a second but takes > 10 seconds).

https://issues.apache.org/jira/browse/OPENJPA-1920

Because of this problem I turned my Map into a OneToMany List of entities that 
contains the map key and somehow I still have the N+1 select problem which is 
odd because I normally don't have it on OneToMany.

I already solved a similar N+1 select problem before on tree structures by 
starting out without having a node's parent in the fetchplan but with the 
children, then fetch all nodes, then add the nodes parent in the fetchplan and 
select the root nodes.

Regards,

Henno Vermeulen
Huize Molenaar

Reply via email to