You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (JIRA)" <ji...@apache.org> on 2019/02/06 09:16:00 UTC
[jira] [Created] (CAY-2527) API to map Object[] result to POJO
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)