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 7784510CF1 for ; Tue, 3 Sep 2013 19:21:54 +0000 (UTC) Received: (qmail 18449 invoked by uid 500); 3 Sep 2013 19:21:53 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 18173 invoked by uid 500); 3 Sep 2013 19:21:53 -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 18134 invoked by uid 99); 3 Sep 2013 19:21:52 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Sep 2013 19:21:52 +0000 Date: Tue, 3 Sep 2013 19:21:52 +0000 (UTC) From: "Albert Lee (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (OPENJPA-2425) SELECT fields with @ExternalValues defined returns datastore values instead of unmapped 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-2425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Albert Lee updated OPENJPA-2425: -------------------------------- Attachment: OPENJPA-2425.patch > SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields > ---------------------------------------------------------------------------------------------- > > Key: OPENJPA-2425 > URL: https://issues.apache.org/jira/browse/OPENJPA-2425 > Project: OpenJPA > Issue Type: Bug > Components: jdbc > Affects Versions: 2.1.2, 2.3.0, 2.2.1.1, 2.2.3 > Reporter: Albert Lee > Assignee: Albert Lee > Attachments: OPENJPA-2425.patch > > > If entity fields is annotated with, > @ExternalValues( { "SMALL=SML", "MEDIUM=MID", "LARGE=LRG" }) > private String s1; > Object query returns umapped value in the object, > Query q = em.createQuery("SELECT a from EntityA a"); > EntityA aPrime = (EntityA) q.getSingleResult(); > Assert.assertEquals("SMALL", aPrime.getS1()); > However, field query returns mapped value from the datastore: > q = em.createQuery("SELECT t0.s1 FROM EntityA t0"); > List res = q.getResultList(); > Iterator itr = res.iterator(); > Object[] values = itr.next(); > Assert.assertEquals("SMALL", values[1]); <<< FAILED here, values[1]=="SML" > This problem also causes a similarly structured CritieriaAPI query to return incorrect values. > If the field type is boolean, even if the database has "true" value, both of the above scenario will return false, due to new Boolean("non-true") always return false. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira