0

我正在这样做。

@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);

是否有任何标准(供应商中立)属性可以自动执行此操作?

4

1 回答 1

1

有时当您更改persistence.xml 时会发生这种情况。检查您的持久性单元中“eclipselink.ddl-generation”的值是否设置为“create-tables”。

<property name="eclipselink.ddl-generation" value="create-tables" />
于 2016-07-27T05:43:26.213 回答