How to return two strings in one return statement in java? -
@suppresswarnings("unchecked") public tblseed getseed(string tablename, string tablename1) { session session = this.sessionfactory.getcurrentsession(); list<tblseed> list = new arraylist<tblseed>(); tblseed tblseed = null; try{ query query = session.createquery("from tblseed seedname =:tablename"); query.setparameter("tablename", tablename); query query1 = session .createquery("from tblseed seedname =:tablename1"); query.setparameter("tablename1", tablename1); list = query.list(); if (list!=null && list.size()>0) { tblseed = list.get(0); } list = query1.list(); if (list != null && list.size() > 0) { tblseed = list.get(0); } }catch(exception ex){ tblseed = null; logger.error("exception:",ex); } return tblseed; }
error- getting error parameter tablename1 couldn't locate while returning tblseed.
plz tell me how can ?
the above code rather cryptic , question off topic problem. issue got. executing 2 hibernate queries query , query1. specify stacktrace posting question.
the erroneous line is
query.setparameter("tablename1", tablename1);
make changes as:
query1.setparameter("tablename1", tablename1);
Comments
Post a Comment