Hibernate中取序列
Session session=HibernateSessionFactory.currentSession();
Transaction tx=session.beginTransaction();
Long s=(Long)session.createSQLQuery("select SQU_TEST.nextval as id from dual")
.addScalar("id",Hibernate.LONG)
.uniqueResult();
tx.commit();
HibernateSessionFactory.closeSession();
Transaction tx=session.beginTransaction();
Long s=(Long)session.createSQLQuery("select SQU_TEST.nextval as id from dual")
.addScalar("id",Hibernate.LONG)
.uniqueResult();
tx.commit();
HibernateSessionFactory.closeSession();
System.out.println(s);