protected Session session = null; protected Transaction tr = null; session=HibernateSessionFactory.getSession(); String sql = ""; //原生sql语句 session.beginTransaction(); //获取connection,执行静态SQL Statement state = session.connection().createStatement(); state.executeQuery(sql); tr.commit(); session.close();