Solved

Java: Convert List<Object[]> to List<MyBean>

Posted on 2016-08-24
3
55 Views
Last Modified: 2016-08-25
Hi Sirs
I have a List<Object[]> that I want to convert to a List<MyBean>, and pass it to JRBeanCollectionDatasoure.
I have options: Looping through the list and Building List<MyBean>, or define an Entity class pointing to a working table.
I wonder if there is not a tool that can do that, similar to what JackSon does with its convertValue, readValue voids, etc...
The SELECT statement based on which I build List<Object[]> comes from a stored procedure handling all my reports requests. So the fields in that SELECT are similar to those in MyBean.

Any idea will be welcome.
0
Comment
Question by:Omer-Pitou
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 41769889
I wonder if there is not a tool that can do that
I suspect not, not least since one problem would be - how would the tool know how to convert from an array into a single object? How are you going to do that manually btw?
0
 

Author Comment

by:Omer-Pitou
ID: 41770845
Thanks CEHJ,
Finally, I will build List<MyBean> manually, while looping through the resultSet.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 41770969
:)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mockito example issue 8 72
servlet  URL Rewriting 1 36
tomcat startup error 5 59
Adding multiple JVM environments to RedHat 6 7 18
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now