本文主要是介绍hibernate获取记录条数的方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
hql获取记录条数
String hql = "select count(ci.channelid) as count from ChannelInfo ci";
query = arg0.createQuery(hql);
count = ((Number) query.iterate().next())
.intValue();
Criteria获取记录条数
totalPage = ((Number) crit.setProjection(
Projections.rowCount()).uniqueResult())
.intValue();
sql获取记录条数
String sql = "select count(ca.CATALOGLID) as count from PLATFORM_CATALOG_INFO ca, PLATFORM_CHANNEL_INFO ch where ch.CHANNELID= '"
+ channelid
+ "' and ca.CHANNELID = ch.CHANNELID order by ca.CATALOGLID";
return session.createSQLQuery(sql).addScalar("count",
Hibernate.INTEGER).uniqueResult();
这篇关于hibernate获取记录条数的方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!