public Long excuteSQL()throws Exception {
return this.getEntityManager().getHibernateTemplate().execute(new HibernateCallback<Long>() {
@Override
public Long doInHibernate(Session session) throws HibernateException, SQLException {
BigDecimal s=(BigDecimal) session.createSQLQuery("select move_plan_seq.nextval from dual").uniqueResult();
return s.longValue();
}
});
}
通过这个匿名内部类,可以根据自己的需要灵活地定义hql,目前还不是很了解,先写下来,慢慢研究