I have a problem. I am using JOOQ, with that I created the following query:
JavaScript
x
create.select(
DSL.field("Mainkey"),
DSL.field("Market"),
DSL.field("Coin"),
DSL.field("Period"),
DSL.field("DateTimeGMT0"),
DSL.field("DateTimeLocal"),
DSL.field("Close"))
.from(DSL.table("vwCD_All_Selection_" + market + "_" + coin + "_1m_Order_DateTime_DESC"))
.where(DSL.field("DateTimeLocal").greaterOrEqual(startDateTime.minusMinutes(1))).fetch();
Now I also have the following class:
JavaScript
public class Candlestick implements Comparable<Candlestick> {
private long MainKey;
private LocalDateTime DateTimeGMT0;
private LocalDateTime DateTimeLocal;
private String Market;
private String Coin;
private String Period;
public Double Close;
}
Now I want the result of the query to be parsed to an ArrayList<Candlestick>
. I found this page: https://www.jooq.org/doc/3.0/manual/sql-execution/fetching/arrays-maps-and-lists/ that shows how to parse the result to a List, bu that is for a specific column of the select. I want to parse the entire object.
How can I achieve this?
Advertisement
Answer
You can use
JavaScript
.fetchInto(Candlestick.class);
instead of
JavaScript
.fetch();
That will give you a collection of Canldestick.