[ https://issues.apache.org/jira/browse/OPENJPA-2425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13789422#comment-13789422 ]
ASF subversion and git services commented on OPENJPA-2425: ---------------------------------------------------------- Commit 1530364 from [~jpaheath] in branch 'openjpa/branches/2.2.x' [ https://svn.apache.org/r1530364 ] OPENJPA-2425: SELECT fields with @ExternalValues defined returns datastore values instead of unmapped fields - applied Albert Lee's patch to 2.2.x. > 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<Object[]> res = q.getResultList(); > Iterator<Object[]> 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 was sent by Atlassian JIRA (v6.1#6144)