序列创建
-- Create sequence seq_app_user_id为序列名,自行修改
create sequence seq_wh_cell_id
minvalue 1
maxvalue 9999999
start with 3000
increment by 1
cache 20;
查询当前用户的所有序列
select * from user_sequences;
查询序列
select seq_xx.nextval from dual;
--或者select seq_xx.nextval from sys.dual;
每查询一次,序列按自定义增长;
删除序列
DROP SEQUENCE seq_xx;
代码应用
@Data
@Entity
@Table(name = "WH_DESCRIPTION")
@SequenceGenerator(name = "descriptionId",sequenceName = "seq_wh_description_id",allocationSize = 1) // 1处
public class WhDescription implements Serializable {
private static final long serialVersionUID = 1040798988878180955L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "descriptionId") // 2处
private Long descriptionId;
|