数据库中ID字段增长方式
原创
©著作权归作者所有:来自51CTO博客作者gaochaojs的原创作品,请联系作者获取转载授权,否则将追究法律责任
1. (strategy = "native")
// Property accessors
@GenericGenerator(name = "generator", strategy = "native")
@Id
@GeneratedValue(generator = "generator")
@Column(name = "ID", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
2.( strategy = "increment")
// Property accessors
@GenericGenerator(name = "generator", strategy = "increment")
@Id
@GeneratedValue(generator = "generator")
@Column(name = "ID", unique = true, nullable = false)
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
SQL中将某列改为自动增长类型
SQL中将某列改为自动增长类型
SQL教程 SQL