[
https://issues.apache.org/jira/browse/CAY-2527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nikita Timofeev closed CAY-2527.
--------------------------------
Resolution: Fixed
> 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
> Priority: Minor
> Fix For: 4.2.M1
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> 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
(v8.3.2#803003)