各位帮帮忙,最近用orcale出现的错误,select * from (select * from db_portals where pro_id= 1 order by opertime desc) where rownum <=4;
这个是orcale语句,里层控制根据id查询,根据编写日期倒叙,外层控制只提取前四条语句。测试后语句无错。from (from DbPortals dp where dp.dbPrograma.proId = 1 order by dp.opertime desc) where rownum <=4
这条是改成HQL后的语句。org.springframework.orm.hibernate3.HibernateQueryException: unexpected token:
( near line 1, column 6
[from (from com.hanqian.pojo.DbPortals dp where dp.dbPrograma.proId = 1 order by dp.opertime desc) where rownum <=4;];
nested exception is org.hibernate.hql.ast.QuerySyntaxError: unexpected token:
( near line 1, column 6 [from (from com.hanqian.pojo.DbPortals dp where dp.dbPrograma.proId = 1 order by dp.opertime desc) where rownum <=4取下来错误消息大概就是这个情况,测试后内层查询无错,就是外层控制条数的加上就报错啦。
希望大家帮忙给看看。
这个是orcale语句,里层控制根据id查询,根据编写日期倒叙,外层控制只提取前四条语句。测试后语句无错。from (from DbPortals dp where dp.dbPrograma.proId = 1 order by dp.opertime desc) where rownum <=4
这条是改成HQL后的语句。org.springframework.orm.hibernate3.HibernateQueryException: unexpected token:
( near line 1, column 6
[from (from com.hanqian.pojo.DbPortals dp where dp.dbPrograma.proId = 1 order by dp.opertime desc) where rownum <=4;];
nested exception is org.hibernate.hql.ast.QuerySyntaxError: unexpected token:
( near line 1, column 6 [from (from com.hanqian.pojo.DbPortals dp where dp.dbPrograma.proId = 1 order by dp.opertime desc) where rownum <=4取下来错误消息大概就是这个情况,测试后内层查询无错,就是外层控制条数的加上就报错啦。
希望大家帮忙给看看。
解决方案 »
- 这是商家给的软硬件方案,不太懂,马上要上系统了,急急急!请坛内专家帮我参谋参谋
- 一个Oracle的基础问题
- 数据库字符集zhs16cgb231280,导出时用us7ascii导出,如何再导回去!
- >>>> 怎样用触发器获取有记录变动的字段名 <<<<
- ORACLE 连SQL SERVER 2005 出现乱码(注SQL SERVER的表的字段是nchar)
- (附图)政府部门2节点数据库RAC报03:36:12.195 [ohasd(4964)]CRS-2765:资源 'ora.crf' 已失败
- sql语句优化和索引问题,高手,急!
- web-oem的问题。
- 看看这条SQL语句怎么写??????
- 表分区时使用函数的困惑
- 数据迁移问题!
- ts$和dba_auto_segadv_ctl两表作用
query.setFirstResult(这里填写开始记录数);
query.setMaxResult(这里填写每页记录数);
reutrn query.list();
不会啊 ,转换成hql语句是,查找的是数据库映射过来的对象,这个没问题。