我这样做。
@Basic(optional = false)
@Column(name = "ID", nullable = false, updatable = false)
@Id
@GeneratedValue(generator = "GLOBAL",
strategy = GenerationType.TABLE)
@TableGenerator(
allocationSize = 1048576,
initialValue = Integer.MAX_VALUE,
pkColumnName = "PK",
valueColumnName = "VL",
table = "GENERATED_ID",
name = "GLOBAL",
pkColumnValue = "GLOBAL"
)
@NotNull
@XmlAttribute
private Long id;
现在当我试图坚持一个实体时,我得到了。
Exception Description: Error preallocating sequence numbers.
The sequence table information is not complete.
我在@TableGenerator
中错过了哪些元素?
该表存在,我看到它在手动插入行时有效。这是正常的吗?
INSERT INTO GENERATED_ID ("PK", "VL") VALUES ("GLOBAL", 1);
是否有自动执行此操作的标准(供应商中立)属性?
答案 0 :(得分:1)
有时会在更改persistence.xml时发生。检查持久性单元中的值是否为“eclipselink.ddl-generation” 设置为“create-tables”。
<property name="eclipselink.ddl-generation" value="create-tables" />