Hibernate id自动生成

2014-11-24 18:53:21 · 作者: · 浏览: 0

create sequence USER_SEQUENCES


minvalue 1


maxvalue 2000


start with 61


increment by 1


cache 20;实现).


在主键属性上加


@SequenceGenerator(name = "USER_SEQUENCES_ID", sequenceName = "USER_SEQUENCES")


@Id


@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "USER_SEQUENCES_ID")