cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikita Timofeev (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAY-2527) API to map Object[] result to POJO
Date Wed, 06 Feb 2019 09:16:00 GMT
Nikita Timofeev created CAY-2527:
------------------------------------

             Summary: API to map Object[] result to POJO
                 Key: CAY-2527
                 URL: https://issues.apache.org/jira/browse/CAY-2527
             Project: Cayenne
          Issue Type: Task
          Components: Core Library
            Reporter: Nikita Timofeev
            Assignee: Nikita Timofeev
             Fix For: 4.2.M1


There are several queries that can return {{Object[]}} as a result (like {{ColumnSelect}}
or {{SQLSelect}}). It can be much more convenient if we can map this result to some POJO.

API usage example:
{code}
class MyPojo {
    String name;
    long count;
    MyPojo(Object[] data) {
        this.name = (String)data[0];
        this.count = (Long)data[1];
    }
}
{code}
{code}
List<MyPojo> result = ObjectSelect
    .columnQuery(Artist.class, Artist.ARTIST_NAME, Artist.PAINTING_ARRAY.count())
    .mapTo(MyPojo::new)
    .select(context);     
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message