java - Getting Null pointer exception when returning from mysql query -
controller class call:
list<foo> foolist = foodao.getfoolist(string.valueof(branchid),customerid,string.valueof(systemindex));
dao class method gets invoked:
public list<foo> getfoolist(string index_branch,string index_cust,string index_sys) { // object[] helo= new object[10]; system.out.println("branchid -> " +index_branch+ "customerid -> " +index_cust+ " systemid -> " +index_sys); return db.query("select * tb_foo branch=? , customer=? , system=?",new rowmapper<foo>() { @override public foo maprow(resultset rs, int i) throws sqlexception { foo foo = new foo(); foo.setpi(rs.getint("foo_pi")); foo.setindex(rs.getint("foo_index")); foo.setfooname(rs.getstring("foo_name")); foo.setfoovalue(""+rs.getint("foo_value")); return foo; } },index_branch,index_cust,index_sys); }
query when provided using commandline
client returns list of values database, rowmapper
not returning. checked if foodao returning null, wasn't. getting null pointer exception on line return db.query(...);
not sure question but,
place breakpoint @
db.query(...);, check db not null
Comments
Post a Comment