I'm doing like this.
@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;
Now when I tries to persist an entity, I got.
Exception Description: Error preallocating sequence numbers.
The sequence table information is not complete.
What elements did I miss in my @TableGenerator
?
The table exists and I see it works when I manually insert the row. Is this normal?
INSERT INTO GENERATED_ID ("PK", "VL") VALUES ("GLOBAL", 1);
Is there any standard(vendor-neutral) property for doing this automatically?