openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2435) Version field in a projection always returned as an Integer.
Date Thu, 17 Oct 2013 23:01:42 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13798562#comment-13798562
] 

ASF subversion and git services commented on OPENJPA-2435:
----------------------------------------------------------

Commit 1533280 from [~jpaheath] in branch 'openjpa/branches/2.1.x'
[ https://svn.apache.org/r1533280 ]

OPENJPA-2435: Version field in a projection always returned as an Integer.

> Version field in a projection always returned as an Integer.
> ------------------------------------------------------------
>
>                 Key: OPENJPA-2435
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2435
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.1.0, 2.3.0, 2.2.2, 2.2.1.1
>            Reporter: Heath Thomann
>            Assignee: Heath Thomann
>
> I've recreated an issue where a @Version field is returned as an Integer when the field
is defined as a Long or Short.  To explain, lets take this entity:
> @Entity
> public class LongVersionEntity implements Serializable {
> .......
>     @Version
>     protected Long version;
> .......
> With this entity take the following query:
> String str = "SELECT o.id, o.version FROM LongVersionEntity o";
> Query query = em.createQuery(str);
> List<Object[]> objectList = query.getResultList();
> for (Object[] objects : objectList) {
>     objects[1].getClass() //Will return Integer.
> Notice in this query we are selecting the version field.  When iterating over the results,
we will find that objects[1].getClass() will return Integer, rather than Long.  The same seems
to be true for the other supported types, except for Timestamp.
> I will provide a full test in the next day or so.
> Thanks,
> Heath



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message