首页 新闻 搜索 专区 学院

hql转sql频繁报错 for input string "xxxx'

-1
悬赏园豆:5 [已关闭问题] 关闭于 2017-04-17 14:30
项目框架sprign mvc hibernate 注解 jsp
这个是hql写法
public List<RegMarpripInfo> getAllMarpripInfo(int offset, int length) { // List<RegMarpripInfo> entitylist = null; String hql = "select new Map( o.id as id ,o.entname as entname ,o.uniscid as uniscid, t.name as enttype, o.regno as regno , o.opscope as opscope, o.regcap as regcap ,i.name as industryco ,o.credit as credit, o.estdate as estdate ) from RegMarpripInfo o,CodeInd i,CodeEnttype t where 1=1 and o.enttype=t.code and o.industryco=i.code "; Query query = sessionFactory.getCurrentSession().createQuery(hql); query.setFirstResult(offset); query.setMaxResults(length); return query.list(); }

 这个是sql写法的。 因为我不会注解方式左连接语句,就改成了sql写法

String sql = "select o.ID as id ,o.ENTNAME as entname ,o.UNISCID as uniscid, t.name as enttype, o.REGNO as regno , o.OPSCOPE as opscope, o.REGCAP as regcap ,i.name as industryco ,o.CREDIT as credit, o.ESTDATE as estdate from reg_marpripinfo o "
+ "LEFT JOIN code_indcode i on (i.NAME=o.INDUSTRYCO) "
+ "LEFT JOIN code_enttype t on (t.CODE=o.ENTTYPE) where 1=1 ";
Query query = sessionFactory.getCurrentSession().createSQLQuery(sql);
<th>注册号</th>
                <th>注册资本</th>
                <th>行业</th>
                <th>信用等级</th>
            </tr>
            <c:if test="${!empty marbb }">
                <c:forEach items="${marbb }" var="mar">
                    <tr>
                    
                        <td>${mar.entname }</td>
                        <td>${mar.uniscid }</td>
                        <td>${mar.enttype }</td>
控制层代码
Page page = marManager.queryForPage(Integer.valueOf(pageNo), 10); request.setAttribute("page", page); List<RegMarpripInfo> mar = page.getList(); request.setAttribute("marList", mar);
问题补充:

如梦一场的主页 如梦一场 | 菜鸟二级 | 园豆:234
提问于:2017-04-17 09:41
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册