openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2299) N+1 select when eager fetching two collection fields of the same entity type
Date Wed, 21 May 2014 11:34:38 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14004589#comment-14004589
] 

Rick Curtis commented on OPENJPA-2299:
--------------------------------------

> <property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
Please do not recommend setting this property. This will not solve your problem and will likely
cause others.

I didn't try, but it is quite unlikely that the combination of these two properties will resolve
the issue reported. Rather than setting either of the two properties from the prior post,
please review the OpenJPA Entity Enhancement page and either use the -javaagent, container,
or build time enhancement.

http://openjpa.apache.org/entity-enhancement.html

> N+1 select when eager fetching two collection fields of the same entity type
> ----------------------------------------------------------------------------
>
>                 Key: OPENJPA-2299
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2299
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, jpa, performance
>    Affects Versions: 2.2.1, 2.3.0
>            Reporter: Vermeulen
>         Attachments: OPENJPA-2299-tests.zip
>
>
> I have a ProductOrder entity that has two @OneToMany lists of ProductOrderLines. When
selecting from ProductOrder, eager fetching does not seem to recurse into the second list
so that each field of each ProductOrderLine in the second list is fetched using a separate
"load field" operation.
> The problem does not occur when there is only one List.
> @Entity
> public class ProductOrder {
> 	@JoinColumn(name = "PLANNED_ORDER_ID")
> 	@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
> 	private List<ProductOrderLine> plannedOrderLines = new ArrayList<ProductOrderLine>();
> 	@JoinColumn(name = "ACTUAL_ORDER_ID")
> 	@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
> 	private List<ProductOrderLine> actualOrderLines = new ArrayList<ProductOrderLine>();
> Expected nr of queries: 1 (for Order) + 1 (for Order.plannedOrderLines) + 1 (for Order.actualOrderLines).
> Actual nr of queries: same as expected + 1 query for each field of each ProductOrderLine
in Order.actualOrderLines.
> Same problem exists when using @JoinTable instead of @JoinColumn (JPA 2.0 only).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message