I’m working with a (legacy) java app and DB and I need to map with MyBatis multiple columns to a single Array property
My query is something like
select price1, price2, price3, qty1, qty2,qty3 ... from table where ....
and the corresponding pojo is
public class Price{
double[] prices = new double[3]
int[] quantity = new int[3]
public double[] getPrices(){}
public void setPrices(double[] prices){...}
public int[] getQty(){...}
public void setQty(int[] quantities){...}
....
}
Unfortunatly I can’t modify neither the query nor the java object
Any tip?
also you can implement the BaseTypeHandler interface and in getNullableResult method the ResultSet variable is available for you. So you can easily get all columns you need and put them to the Array.