SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(hql);用getCurrentSession()执行不了SQL 如果用getCurrentSession()会报错:hibernate4不能转换为hibernate3
Query query = sessionFactory.openSession().createQuery(hql);可以执行sql
createSQLQuery(hql)执行原生SQL,即HQL
createQuery(hql)执行sql