Skip to content

Commit 2c784b4

Browse files
committed
use bigserial instead of serial8 on Informix
as recommended by Vladimír Kuruc
1 parent 68c8712 commit 2c784b4

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/identity/InformixIdentityColumnSupport.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,20 @@ public boolean supportsIdentityColumns() {
2424
@Override
2525
public String getIdentitySelectString(String table, String column, int type)
2626
throws MappingException {
27-
switch (type) {
28-
case Types.BIGINT:
29-
return "select dbinfo('serial8') from informix.systables where tabid=1";
30-
case Types.INTEGER:
31-
return "select dbinfo('sqlca.sqlerrd1') from informix.systables where tabid=1";
32-
default:
33-
throw new MappingException("illegal identity column type");
34-
}
27+
return "select dbinfo('" + switch ( type ) {
28+
case Types.BIGINT -> "bigserial";
29+
case Types.INTEGER -> "sqlca.sqlerrd1";
30+
default -> throw new MappingException( "illegal identity column type" );
31+
} + "') from informix.systables where tabid=1";
3532
}
3633

3734
@Override
3835
public String getIdentityColumnString(int type) throws MappingException {
39-
switch (type) {
40-
case Types.BIGINT:
41-
return "serial8 not null";
42-
case Types.INTEGER:
43-
return "serial not null";
44-
default:
45-
throw new MappingException("illegal identity column type");
46-
}
36+
return switch ( type ) {
37+
case Types.BIGINT -> "bigserial";
38+
case Types.INTEGER -> "serial";
39+
default -> throw new MappingException( "illegal identity column type" );
40+
} + " not null";
4741
}
4842

4943
@Override

0 commit comments

Comments
 (0)