0

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?

Jin Kwon
  • 20,295
  • 14
  • 115
  • 184

1 Answers1

1

Sometimes it happens when you change persistence.xml. Check if in your persistence unit the value of "eclipselink.ddl-generation" is set to "create-tables".

<property name="eclipselink.ddl-generation" value="create-tables" />