public List queryTradeConfirmBusinFlag() { final String sql = "select C_BUSINFLAG, C_BUSINNAME from tbusinflag"; return (List) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Query query = session.createSQLQuery(sql); List<InitBusinFlag> list = query.list(); Iterator iter = list.iterator(); list = new ArrayList<InitBusinFlag>(); while(iter.hasNext()) { Object[] obj = (Object[])iter.next(); InitBusinFlag businFlag = new InitBusinFlag(); businFlag.setBusinFlag(obj[0].toString()); businFlag.setBusinName(obj[1].toString()); list.add(businFlag); } logger.debug("读取交易确认查询交易类型数据成功..."); return list; } }); }
C_BUSINFLAG 只能查出一个字符来
C_BUSINFLAG 在oracle数据库中是char(2)类型
改成final String sql = "select cast(C_BUSINFLAG as varchar2(2)), C_BUSINNAME from tbusinflag";
OK |