column = " lt.loantypeid,lt.loantype, SUM(ld.LoanDr) as dr, SUM(ld.LoanCr) as cr, SUM(ld.LoanDr-ld.LoanCr) as balance ";
$bQuery = "SELECT " + column + " from loandetail ld inner join loantype lt on( lt.loantypeid = ld.loantypeid) "
+ " where ld.memberid = ? And ld.Centerid =? And ld.officeid= ? "
+ " group by lt.loantypeid,lt.loantype "
+ " order by lt.loantypeid ";
nparameters = new HashMap<Integer, Object>();
nparameters.put(1, $memberid);
nparameters.put(2, $centerid);
nparameters.put(3, $branchid);
List<Object[]> loans = nqe.ExecuteNativeSelectQuery($bQuery, nparameters, em);
columns = this.nqe.getColumnsArray(column);
columnType = new Integer[]{Types.INTEGER, Types.VARCHAR, Types.DOUBLE, Types.DOUBLE, Types.DOUBLE};
JsonArray LoanDetail = null;
if (loans != null && loans.size() > 0) {
LoanDetail = rg.getJsonArrayFromDatabase(loans, columns, columnType);
}
getJsonArrayFromDatabase is a function to convert resultset to JSON
If anyone require these classes and function, you can email me at aftabthedeveloper@gmail.com