对于高级别的需求,我必须将@Id列的类型从Long更改为String,其中value可以选择,或者只是增加,在软件安装期间定义。
所以今天我有这个:
@Id
@TableGenerator(
schema = "SIS",
name = "cadvei001_gen",
table = "ADMSIS000",
pkColumnName = "TABELA",
pkColumnValue = "CADVEI001",
valueColumnName = "VALOR",
allocationSize = 1)
@GeneratedValue(strategy = GenerationType.TABLE, generator = "cadvei001_gen")
@Column(name = "VEI001_CODIGO", length = 20, unique = true)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
当然,这不起作用。我的问题是:是否可以使用Hibernate的函数从tableGerenator
获取值并直接更新它,而不使用此注释,如:
Hibernate.getSequence("CADVEI001");
Hibernate.updateSequence("CADVEI001");
谢谢大家!