数据库字段ID增长方式
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;
}
本文转自 gaochaojs 51CTO博客,原文链接:http://blog.51cto.com/jncumter/163581,如需转载请自行联系原作者