天天看点

spring的hibernateTemplate中执行sql语句

org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
           

注意此处要用openSession!

this.getHibernateTemplate().getSessionFactory().openSession().createSQLQuery(sql).executeUpdate();