i expected below code to create table which has BIGSERIAL column type id.
@Entity
public class NewEntity1 implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
...
but it created:
CREATE TABLE NEWENTITY1 (ID SERIAL NOT NULL, PRIMARY KEY (ID))
i want to make it BIGSERIAL column (not SERIAL). how can i fix this?
my environment:
thanks.
The problem here is that EclipseLink PostgreSQLPlatform hard codes the string it uses within the printFieldIdentityClause to be "SERIAL". This should be customizable though, so please file a bug to have it changed.
Other than using columnDefinition, you can create a sublclass of the PostgreSQLPlatform and override the printFieldIdentityClause method to print off what you need. Ie:
@Override
public void printFieldIdentityClause(Writer writer) throws ValidationException {
try {
writer.write(" SERIAL");
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);
}
}
and then set your persistence unit properties to use your platform class instead:
<property name="eclipselink.target-database" value="yourpackage.yourPlatformClass"/>