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 4F46510C4B for ; Thu, 17 Oct 2013 19:24:54 +0000 (UTC) Received: (qmail 278 invoked by uid 500); 17 Oct 2013 19:24:47 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 193 invoked by uid 500); 17 Oct 2013 19:24:44 -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 143 invoked by uid 99); 17 Oct 2013 19:24:42 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2013 19:24:42 +0000 Date: Thu, 17 Oct 2013 19:24:42 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OPENJPA-2343) Version field returns null when explicity projected from a JOIN in SELECT clause 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-2343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13798307#comment-13798307 ] ASF subversion and git services commented on OPENJPA-2343: ---------------------------------------------------------- Commit 1533222 from [~jpaheath] in branch 'openjpa/branches/2.2.1.x' [ https://svn.apache.org/r1533222 ] OPENJPA-2343: Version field returns null when explicity projected from a JOIN in SELECT clause - based fix off of patch provided by Howard Kelsey. Merged 2.1.x commit to 2.2.1.x. > Version field returns null when explicity projected from a JOIN in SELECT clause > -------------------------------------------------------------------------------- > > Key: OPENJPA-2343 > URL: https://issues.apache.org/jira/browse/OPENJPA-2343 > Project: OpenJPA > Issue Type: Bug > Components: query > Affects Versions: 2.3.0, 2.2.1 > Reporter: howard kelsey > Assignee: Rick Curtis > Fix For: 2.3.0 > > Attachments: OPENJPA-2343-2.2.1.x.patch > > > With these entities: > @Entity > public class Foo { > private int id; > private int version; > @Id > public int getId() { > return id; > } > public void setId(int id) { > this.id = id; > } > public void setVersion(int version) { > this.version = version; > } > @Version > public int getVersion() { > return this.version; > } > } > @Entity > public class Bar{ > private int id; > private Foo foo; > @Id > public int getId() { > return id; > } > public void setId(int id) { > this.id = id; > } > public void setFoo(Foo foo) { > this.foo = foo; > } > @ManyToOne > public Foo getFoo() { > return foo; > } > } > Insert a record for each associating foo with bar. > Foo foo = new Foo(); > em.getTransaction().begin(); > em.persist(foo); > Bar bar = new Bar(); > bar.setFoo(foo); > em.persist(bar); > em.getTransaction().commit(); > em.close(); > queries > select bar.id as id, foo as foo from Bar bar join bar.foo foo > The version field is available via foo.getVersion() > select bar.id as id, foo.version as version from Bar bar join bar.foo foo > version is always null. > By enabling the jdbc debug I can see that the actual SQL being run is correct but the value is just not hydrated. -- This message was sent by Atlassian JIRA (v6.1#6144)