hibernater查询各语句用法.docVIP

  • 6
  • 0
  • 约22.03万字
  • 约 44页
  • 2016-09-13 发布于河南
  • 举报
hibernater查询各语句用法

hibernater查询各语句用法 1.from子句 from Person 表明从Person持久化类中选出全部的实例。 推荐:from Person as p 2.select子句 select from Person as p select .firstName from Person as p select new list(, p.address) from Person as p select new ClassTest(, p.address) from Person as p (有前提) select as personName from Person as p select new map( as personName) from Person as p (与new map()结合更普遍) 3.统计函数查询: 1: count() 统计记录的条数 2: min() 求最小值 3: max() 求最大值 4: sum() 求和 4: avg() 求平均值 //取得Student的数量 Query query=session.createQuery(select count(*) from Student) //avg()取得Student平均年龄 Query

文档评论(0)

1亿VIP精品文档

相关文档