I am building an entity and i need to populate all the fields from a result set from a jpql resultset like like so:
summary.setPeriod_1((BigDecimal)object[4]);
summary.setPeriod_2((BigDecimal)object[5]);
summary.setPeriod_3((BigDecimal)object[6]);
summary.setPeriod_4((BigDecimal)object[7]);
The problem is that there are 50x periods and it looks ugly and takes up lots of space.
is it possible to do it as a for loop something like this:
for(int i=1; i<54; i++){
summary.setPeriod_[i]((BigDecimal)object[i+4]);
}