Hibernate:save()后获取oracle 自增主键和数据生成的逐渐不一致
public boolean save(Cardownerinfo ownerinfo) { Session session = HibernateSessionFactory.getSession(); Transaction tx = null; try { tx = session.beginTransaction(); session.save(ownerinfo); tx.commit(); return true; } catch (RuntimeException re) { tx.rollback(); log.error("==CardownerinfoSevices save failed==", re); re.printStackTrace(); } finally { session.close(); } return false; }public void testSave() { Cardownerinfo ownerinfo = new Cardownerinfo(); ownerinfo.setOwnername("人卡465"); ownerinfo.setCreatetime(new Date()); CardownerinfoSevices ownerinfoSer = new CardownerinfoSevices(); boolean save = ownerinfoSer.save(ownerinfo); if (save) { System.out.println(ownerinfo.getOwnerid()); System.out.println("successfuly"); } else { System.out.println("failed"); } }CREATE SEQUENCE "TYZHUSER"."CARDOWNERINFO_S" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 121 CACHE 20 ORDER NOCYCLE