摘要:
手动配置事务: @Autowired private SessionFactory sessionFactory; Session session=sessionFactory.openSession(); Transaction tx=null; //先开启一个事务 tx=session.begi 阅读全文
摘要:
参数绑定: Hibernate中对动态查询参数绑定提供了丰富的支持,那么什么是查询参数动态绑定呢?其实如果我们熟悉传统JDBC编程的话,我们就不难理解查询参数动态绑定,如下代码传统JDBC的参数绑定: PrepareStatement pre=connection.prepare(“select * 阅读全文
摘要:
SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(hql);用getCurrentSession()执行不了SQL 如果用getCurrentSession()会报错:hibernate4不能转换为hibernate 阅读全文