I’ve copied this code almost exactly from a similar post by Konstantin yet no rows returned.
dmdNum is defined in the MySql table as Int(11) and I am passing in the value of 19473. I’ve tried
removing the parameter and hardcoding 19473 into the query string.
I’m using Cuba 6.10.3. Any ideas?
Thanks, Dan
@Service(DeliveryTicketOrderService.NAME)
public class DeliveryTicketOrderServiceBean implements DeliveryTicketOrderService {
@Inject
private Persistence persistence;
public List<DeliveryTicket> getAllDeliveryTicketsforDMDNum(Integer[] dmdNum) {
String sqlQuery = "select * from dmdoffice_delivery_ticket d where d.dmd_number = ?";
try {
QueryRunner queryRunner = new QueryRunner(persistence.getDataSource());
return queryRunner.query(sqlQuery,
new Object[]{dmdNum},
new ResultSetHandler<List<DeliveryTicket>>() {
@Override
public List<DeliveryTicket> handle(ResultSet rs) throws SQLException {
ArrayList<DeliveryTicket> list = new ArrayList<>();
while (rs.next()) {
DeliveryTicket dt = new DeliveryTicket();
list.add(dt);
}
return list;
}
});
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}