我现在需要写一个SQL String hql = "from TbArticle model where 1=1 ";
hql += "and model.subject.id = "+subjectId+" ";
hql += "and model.type = 2 ";
hql += "order by model.createTime desc";
持久化层用的是hibernate
数据库是oracle问题 现在的hql语句能查出所有的,但是我想用hql语句只查第一条,怎么写 怎么写 求帮助!
我试了一下 加 limit 1 但是知道肯定不行 这个mysql的 求帮助 在线等 有答案就结贴
hql += "and model.subject.id = "+subjectId+" ";
hql += "and model.type = 2 ";
hql += "order by model.createTime desc";
持久化层用的是hibernate
数据库是oracle问题 现在的hql语句能查出所有的,但是我想用hql语句只查第一条,怎么写 怎么写 求帮助!
我试了一下 加 limit 1 但是知道肯定不行 这个mysql的 求帮助 在线等 有答案就结贴
解决方案 »
- 100 分 求一sql语句
- 问一下装完 oracle 数据库后,要怎么重新设置 classpath 来运行 j2se 程序 ?
- 为何from中同一个表用两次???????????????????????
- 求条SQL语句~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 救急 一个比赛分组问题
- 高分求解,相同的语句执行计划一个是按全表扫描,一个是按索引扫描,为什么呢?
- 紧急求一sql语句
- 关于数据库同步的问题,急!
- ORACLE与内存的问题
- TNS-12518: TNS: 监听程序无法分发客户机连接 navicate连接oracle出现问题,网上各种搜没有能够解决的
- vb.net如何连接oracle数据库?
- 急问ORACLE数据库同步的方法步骤!谢谢!
select * from
(select * from TbArticle model order by model.createTime desc)
where rownum<2
可是我要用hql语句啊 能改成hql语句吗?
hql += "and model.subject.id = "+subjectId+" ";
hql += "and model.type = 2 ";
hql += "order by model.createTime desc)";
hql += " where rownum<2";