我正在使用hibernate 3,oracle 10g。我有一张桌子:主题。定义在这里CREATE TABLE SUBJECT ( SUBJECT_ID NUMBER (10), FNAME VARCHAR2(30) not null, LNAME VARCHAR2(30) not null, EMAILADR VARCHAR2 (40), BIRTHDT DATE not null, constraint pk_sub primary key(subject_id) USING INDEX TABLESPACE data_index ) ;插入新主题时,sub_seq用于创建主题ID,定义在此处create sequence sub_seq MINVALUE 1 MAXVALUE 999999999999999999999999999 START WITH 1 INCREMENT BY 1 CACHE 100 NOCYCLE ;Subject类是这样的:@Entity@Table(name="ktbs.syn_subject")public class Subject { @Id @Column(name="subject_id") @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SUB_SEQ") @SequenceGenerator(name="SUB_SEQ", sequenceName = "SUB_SEQ") private long subjectId; private String fname; private String lname; private String emailadr; private Date birthdt;}在主题表中,数据库中有4555个主题由excel的plsql脚本加载,并且sub_sequence运行良好。主题ID的范围是1--4555。但是,当我使用休眠模式从应用程序中添加主题时,序列号跳至255050。运行几天后,休眠模式生成的主题ID如下所示:270079270078270077270076270075270074270073270072270071270070270069270068270067270066270065270064270063270062270061270060270059270058270057270056270055270054270053270052270051270050265057265056265055265054265053265052265051265050260059260058260057260056260055260054260053260052260051260050255067255066255065255064255063255062255061255060255059255058255057255056255055255054255053255052255051255050455545544553....1差距很大:4555至255051、255067至260051、265057至270051这是浪费,不是期望的行为。有谁知道为什么会这样,并且很热要解决它谢谢
3 回答
- 3 回答
- 0 关注
- 701 浏览
添加回答
举报
0/150
提交
取消