Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0469D9262 for ; Sat, 28 Apr 2012 10:16:20 +0000 (UTC) Received: (qmail 17677 invoked by uid 500); 28 Apr 2012 10:16:19 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 17403 invoked by uid 500); 28 Apr 2012 10:16:14 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 17353 invoked by uid 99); 28 Apr 2012 10:16:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Apr 2012 10:16:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Apr 2012 10:16:09 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 227ED425963 for ; Sat, 28 Apr 2012 10:15:48 +0000 (UTC) Date: Sat, 28 Apr 2012 10:15:48 +0000 (UTC) From: "Mark Struberg (JIRA)" To: dev@openjpa.apache.org Message-ID: <33441073.6154.1335608148167.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1862440823.5827.1335459738190.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (OPENJPA-2179) 'distinct' and 'join' combinations lead lots of unneccessary sub-queries for @Embedded and @Lob fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13264283#comment-13264283 ] Mark Struberg commented on OPENJPA-2179: ---------------------------------------- I'm close to a working unit test now. Just need to figure a way how to detect those subselects automatically via a unit test? Of course, the first best thing is to have it on the console already. But that cannot be easily checked via an assert... Any tips? > 'distinct' and 'join' combinations lead lots of unneccessary sub-queries for @Embedded and @Lob fields > ------------------------------------------------------------------------------------------------------ > > Key: OPENJPA-2179 > URL: https://issues.apache.org/jira/browse/OPENJPA-2179 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 2.2.0 > Reporter: Mark Struberg > Assignee: Mark Struberg > Fix For: 2.3.0 > > > I have an Entity (Course) with a simple @Embedded field and a @Lob. I do not use any LAZY attribution on them! > If I do a normal em.find, the entity will be loaded as a whole (all the fields, including the embedded and the lob will be fetched immediately). > Sidenote: the Lecturer referred in the select is defined as > @OneToMany(mappedBy = "course", > cascade = {CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE}, > orphanRemoval = true, fetch = FetchType.EAGER) > @OrderColumn(name = "POSITION") > private List lecturers; > The following selects DO work > * "select c from Course c join c.lecturers l " > * "select distinct c from Course c" > The following selects create tons of subqueries! 1 separate sub-query for each @Embedded field, and also for each @Lob > * "select distinct c from Course c join c.lecturers l " > * "select distinct c from Lecturer l join l.course c" > * "select c from Lecturer l join l.course c" > This happens ONLY if I run this stuff against Oracle. In MySQL it seems to work properly. > I'll try to create a unit test for it. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira