HQL 查询语句问题? 朋友们帮忙看一下..

[复制链接]
查看11 | 回复2 | 2010-5-17 16:38:14 | 显示全部楼层 |阅读模式
执行这天Hql语句时报如下错误:
org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: and near line 1, column 164:
HQL语句如下:
from BtripApplication btrip left join fetch btrip.applicationItemList btripItem
inner join btrip.organizationUnit orgUnit where
and ((btr.employee.ouCode like :code1 or btr.employee.ouCode like :code2)
and (btr.employee.ouCode like :orgUnitSearchPath or btr.employee.ouCode like :orgUnitSearchPath||'/%'))
and orgUnit.type is null or orgUnit.type =:orgGrounp
and :year is null or btripItem.from between to_date(:year||'-01-01','yyyy-MM-dd') and btripItem.toDate to_date(:year||'-12-31','yyyy-MM-dd');
.....
省略部分赋值的代码..
我看了一下,还真没找到哪里错误!。
谢谢.各位朋友的指点..

回复

使用道具 举报

千问 | 2010-5-17 16:38:14 | 显示全部楼层
把where后面的and去掉
回复

使用道具 举报

千问 | 2010-5-17 16:38:14 | 显示全部楼层
unexpected token 意思是语法错误,好好看吧,我前一段时间一直在看,问题在于你的语句用到不合法的东西,好好看吧,推荐一个工具:MyEclipse中的Hql工具,很方便
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行