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 1D13110CD6 for ; Thu, 5 Dec 2013 18:49:36 +0000 (UTC) Received: (qmail 44752 invoked by uid 500); 5 Dec 2013 18:49:36 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 44694 invoked by uid 500); 5 Dec 2013 18:49:35 -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 44671 invoked by uid 99); 5 Dec 2013 18:49:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2013 18:49:35 +0000 Date: Thu, 5 Dec 2013 18:49:35 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OPENJPA-2318) Left outer join is not generated when specifien using Criteria API 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-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13840400#comment-13840400 ] ASF subversion and git services commented on OPENJPA-2318: ---------------------------------------------------------- Commit 1548238 from [~fyrewyld] in branch 'openjpa/branches/2.2.x' [ https://svn.apache.org/r1548238 ] OPENJPA-2318: Left outer join is not generated when specified using Criteria API > Left outer join is not generated when specifien using Criteria API > ------------------------------------------------------------------ > > Key: OPENJPA-2318 > URL: https://issues.apache.org/jira/browse/OPENJPA-2318 > Project: OpenJPA > Issue Type: Bug > Components: criteria > Affects Versions: 2.1.1 > Environment: Windows/Oracle > Reporter: Lev > Assignee: Pinaki Poddar > Fix For: 2.3.0 > > Attachments: OPENJPA-2318-TEST.patch, OPENJPA-2318.patch > > > Entities > @Entity > @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) > public class DiscoveryObjectImpl { > @Id > private String id; > public String getId() { > return id; > } > public void setId(String id) { > this.id = id; > } > @ManyToOne(cascade = CascadeType.ALL) > private DiscoveryObjectImpl parent; > > public DiscoveryObjectImpl getParent() { > return parent; > } > public void setParent(DiscoveryObjectImpl parent) { > this.parent = parent; > } > } > @Entity > public class ColumnFormatImpl extends DiscoveryObjectImpl { > @Basic > String formatName; > } > @Entity > public class ColumnImpl extends DiscoveryObjectImpl { > @OneToMany(mappedBy="parent") > private List formats = new ArrayList(); > } > @Entity > public class VirtualTableImpl extends DiscoveryObjectImpl { > @OneToMany(mappedBy="parent") > private List columns = new ArrayList(); > } > persistence.xml > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" > version="1.0"> > > org.apache.openjpa.persistence.PersistenceProviderImpl > com.ibm.infosphere.test.model.interfaces.impl.DiscoveryObjectImpl > com.ibm.infosphere.test.model.interfaces.impl.VirtualTableImpl > com.ibm.infosphere.test.model.interfaces.impl.ColumnImpl > com.ibm.infosphere.test.model.interfaces.impl.ColumnFormatImpl > true > > > > > > > > > > > > > > > > > > > > > > > Test code: > public void test() { > CriteriaQuery cri = cb.createQuery(ColumnImpl.class); > Root tbl = cri.from(VirtualTableImpl.class); > Join col = tbl.join("columns"); > Join format = col.join("formats", JoinType.LEFT); > cri.where(cb.equal(format.get("formatName"), "ABC")); > cri.select(col); > em.createQuery(cri).getResultList(); > } > Generated SQL: > SELECT t1.id, t1.PARENT_ID > FROM VirtualTableImpl t0 INNER JOIN ColumnImpl t1 ON t0.id = t1.PARENT_ID INNER > JOIN ColumnFormatImpl t2 ON t1.id = t2.PARENT_ID > WHERE (t2.formatName = ? AND 1 = 1) > As you can see the secong JOIN is INNER instead of LEFT OUTER > -- This message was sent by Atlassian JIRA (v6.1#6144)