SQL查询:

  5.2之后的版本:

    NativeQuery<Order> sqlQuery = session.createNativeQuery("select * from t_order", Order.class);
List<Order> list = sqlQuery.list();

  for(Order order : list) {
System.out.println(order);
}

  5.2之前的版本:

    SQLQuery sqlQuery = session.createSQLQuery("select * from t_order");
sqlQuery.addEntity(Order.class);

   List<Order> list = sqlQuery.list();

  5.1之前的版本:

    SQLQuery sqlQuery = session.createSQLQuery("select * from t_order");

    List<Object[]> list = sqlQuery.list();

  for(Object[] order : list) {
for(Object column : order) {
       System.out.print(column);
     System.out.print(" ");
}
System.out.println();
}

Hibernate SQL的更多相关文章

  1. Hibernate SQL方言 (hibernate.dialect) Spring配置文件applicationContext.xml

    转自:http://www.cnblogs.com/wj-wangjun/archive/2009/10/21/1587624.html Hibernate SQL方言 (hibernate.dial ...

  2. atitit。 hb Hibernate sql 查询使用

    atitit. hb  Hibernate sql 查询使用 #----------返回list<map>法..这个推荐使用.      q.setResultTransformer(Tr ...

  3. hibernate sql查询转换成VO返回list

    hibernate sql查询转换成VO @Override public List<FenxiVo> getTuanDuiFenxiList(FenxiVo FenxiVo,Intege ...

  4. Display Hibernate SQL to console – show_sql , format_sql and use_sql_comments

    (转)灵活控制 Hibernate 的日志或 SQL 输出,以便于诊断 - CS408 - 博客园 https://www.cnblogs.com/lixuwu/p/7479496.html Disp ...

  5. log4j显示hibernate sql参数的配置

    #下面的两条配置非常重要,设置为trace后,将可以看到打印出sql中 ? 占位符的实际内容 #this is the most important config for showing parame ...

  6. log4j.properties中的这句话“log4j.logger.org.hibernate.SQL=DEBUG ”该怎么写在log4j.xml里面呢?

    http://www.cnblogs.com/gredswsh/p/log4j_xml_properties.html 请问:log4j.properties中的这句话“log4j.logger.or ...

  7. Hibernate SQL查询 addScalar()或addEntity()

    本文完全引用自: http://www.cnblogs.com/chenyixue/p/5601285.html Hibernate除了支持HQL查询外,还支持原生SQL查询.          对原 ...

  8. Hibernate SQL实际sql语句监控- p6spy+hibernate+proxool 设置

    由于ORM工具的缘故,我们调试程序的时候远没有直接在程序里直接写个string的SQL简单,想当年查个sql是有多么的幸福,一行sql = "select * from ..."找 ...

  9. Hibernate SQL Dialect 方言

    RDBMS Dialect DB2 org.hibernate.dialect.DB2Dialect DB2 AS/400 org.hibernate.dialect.DB2400Dialect DB ...

  10. Hibernate SQL优化技巧dynamic-insert="true" dynamic-update="true"

    最近正在拜读Hibernate之父大作<Java Persistence with Hibernate>,颇有收获.在我们熟悉的Hibernate映射文件中也大有乾坤,很多值得我注意的地方 ...

随机推荐

  1. Generic Realtime Intermediary Protocol

    转自:https://pushpin.org/docs/protocols/grip/ Introduction The Generic Realtime Intermediary Protocol ...

  2. 02HDFS架构

    https://www.cnblogs.com/zhoujingyu/p/5040957.html https://blog.csdn.net/firstchange/article/details/ ...

  3. C# to IL 3 Selection and Repetition(选择和重复)

    In IL, a label is a name followed by the colon sign i.e ":". It gives us the ability to ju ...

  4. python 通过pymongo操作mongoDB执行sort

    在mongo shell 中对数据进行排序操作的时候 db.getCollection('ANJUKE_PRICE').find({},{'id':1,'_id':0}).sort({'id':1}) ...

  5. WebService的几种验证方式

    转 http://www.cnblogs.com/yoshiki1895/archive/2009/06/03/1495440.html WebService的几种验证方式 1.1      WebS ...

  6. Set ARITHABORT Option设置为ON

    MSDN注释中提到,应该总是将Set ARITHABORT Option设置为ON,原因有四: 1,如果SSMS和application client的设置不同,那么会导致application cl ...

  7. spring 整合Junit学习

    测试一般是测试的局部功能,使用时需要自己写个测试相关的spring配置文件,比较费劲,所以常用的是纯配置的方式来实现测试. @RunWith(SpringJUnit4ClassRunner.class ...

  8. Selenium2+python自动化38-显式等待(WebDriverWait)

    From: https://www.cnblogs.com/yoyoketang/p/6517477.html 前言: 在脚本中加入太多的sleep后会影响脚本的执行速度,虽然implicitly_w ...

  9. What is SolrCloud? (And how does it compare to master-slave?)

    What is SolrCloud? (And how does it compare to master-slave?) SolrCloud is a set of new features and ...

  10. JavaEE Web 开发 链接 mysql 出现 Class.not found的错误

    明明在项目的library里头导入过mysql-connector.jar的包,但是在加载driver的时候eclipse一直报这个错误.解决方案其实很简单,就是同样的jar包在tomcat的安装目录 ...