I am building a pie chart and a bar graph on the same page using JSF, and both conponents getting information from this query:
select 'ACCOUNTS'PRODUCT,sum(ACCT_BAL_LCY) AMOUNT from account_master where schm_type in(?, ?, ?,?) and ACCT_BAL_LCY >0
union select 'BILLS'PRODUCT, sum(LIAB_AMT_LCY)AMOUNT from bills_details union select 'DOCUMENTARY CREDITS'PRODUCT,sum(LIAB_AMOUNT)AMOUNT
from DC_DETAILS union select 'GUARANTEES'PRODUCT, sum(LIAB_AMT_LCY)AMOUNT from BG_DETAILS;
The method executing it is :
private void createPieModel() {
pieModel = new PieChartModel();
categoryModel = new CartesianChartModel();
ChartSeries act = new ChartSeries();
act.setLabel("Product Types");
Connection conn;
db = new DBConnection();
conn = db.getDbConnection();
pr = new BiProperties();
try {
String sql = pr.getDBProperty().getProperty("liability.bank");
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, "SBA");
ps.setString(2, "CAA");
ps.setString(3, "TDA");
ps.setString(4, "CCA");
ResultSet rs = ps.executeQuery();
int i = 0;
while (rs.next()) {
pieModel.set(rs.getString(1), rs.getInt(2));
act.set(rs.getString(1), rs.getInt(2));//Error on this Line
cities.put(i, rs.getString(1));
i++;
}
categoryModel.addSeries(act);
} catch (SQLException asd) {
log.debug(Level.FATAL, asd);
}
}
At times both Graphs Shows at, times none of the graphs show and at other times, only the Pie chart Show. On checking the Back end I am getting this error:
java.sql.SQLException: Numeric Overflow
How can I avoid this as it is happening randomly??