首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

hibernate查询的有关问题 java2000_net

2012-04-02 
hibernate查询的问题java2000_netselect *from productInfoas pJOINbrandInfo as b on p.brand_Idin(selec

hibernate查询的问题 java2000_net
select *from productInfo as p JOIN brandInfo as b on p.brand_Id in(select b.brand_Id from brandInfo where b.brand_name like '%雅%') 这个是数据库中用sql写的 可以正确执行 转化为下面hqlsql1的语句就会报错
这里是错误信息:
Caused by: line 1:188: expecting CLOSE, found 'null'
org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found 'null' near line 1, column 188 [ from com.wowo.homefitment.beans.ProductInfo as p inner join p.brandInfo where p.brandInfo.brandId in (select p.brandInfo.brandId from p.brandInfo where p.brandInfo.brandName like'%雅鼎%']
这个是转换的hibernate语句:
String hqlsql1 = " from ProductInfo as p inner join p.brandInfo where p.brandInfo.brandId in (select p.brandInfo.brandId from p.brandInfo where p.brandInfo.brandName like'%"+condition+"%'";


[解决办法]
String hqlsql1 = " from ProductInfo as p inner join p.brandInfo where p.brandInfo.brandId in (select p.brandInfo.brandId from p.brandInfo where p.brandInfo.brandName like'%"+condition+"%'"; 

你转换的这句我没看懂 开头没有select * 结束时少一个括回。不知道是就这么写啊 ?还是你写错了?

热点排行