Hello
I need a bit assistance
I am filling grid from stored procedure, so I have table class, service and ui to fetch data into grid
public class Stock {
private String id;
private String resource;
private String s1;
private String s2;
private String s3;
private String s4;
private String s5;
private String s6;
private String s7;
private String total;
public Stock(String id, String resource, String s1, String s2, String s3, String s4, String s5, String s6, String s7, String total) {
this.id = id;
this.s1 = s1;
this.s2 = s2;
this.s3 = s3;
this.s4 = s4;
this.pcns = pcns;
this.s5 = s5;
this.s6 = s6;
this.s7 = s7;
this.total = total;
}
…getters and setters
}
@Component
public class StockService {
@Autowired
private JdbcTemplate jdbcTemplate;
public List<Stock> findAll() {
return jdbcTemplate.query("call stock_proc",
(rs, rowNum) -> new Stock(
rs.getString("id"),
rs.getString("Resource"),
rs.getString("S1"),
rs.getString("S2"),
rs.getString("S3"),
rs.getString("S4"),
rs.getString("S5"),
rs.getString("S6"),
rs.getString("S7"),
rs.getString("Total")
));
}
}
in UI I have
@Autowired
private StockService service;
fillGrid();
grid.setColumns(
“id”,
“resource”,
“s1”,
“s2”,
“s3”,
“s4”,
“s5”,
“s6”,
“s7”,
“total”
);
private void fillGrid() {
List stocks = service.findAll();
grid.setItems(stocks);
}
I am getting error in bolded line List stocks = service.findAll();
nested exception is java.lang.NullPointerException
No clue what to do
Thank you