Hibernate 6 native IDENTITY


@GeneratedValue(strategy = GenerationType.IDENTITY) was working fine with hibernate 5 + same jdbc (exasol). Now I got a strange error from driver:
com.exasol.jdbc.NotImplemented: Feature not supported - Auto-generated keys.

Old v5 was calling back:

public String getIdentitySelectString(String table, String column, int type) throws MappingException {
				"' AND COLUMN_SCHEMA='"+table.substring(0, table.indexOf(".")).toUpperCase() +
				"' AND COLUMN_TABLE='"+(table.substring(table.indexOf(".")+1)).toUpperCase()+"'";


Old v5 had GeneratorClass in Dialect file, and this used to work for simple logging inserts:

public Class getNativeIdentifierGeneratorClass() { return SequenceGenerator.class; }

reworked for v6:

public jakarta.persistence.GenerationType getNativeIdentifierGenerationType() {
    return GenerationType.SEQUENCE;

Also tried with GenerationType.IDENTITY

The v5 logs told: “Inserting entity SecurityLog (native id)” - just after “ActionQueue - Executing identity-insert immediately”.
Now v6 fails just next to “ActionQueue - Executing identity-insert immediately”:

2023-09-14 22:03:45.836 [http-nio-8080-exec-3] DEBUG o.h.SQL - insert into security_log (email,id_result,ip_address,logon_date) values (?,?,?,?)
Hibernate: insert into security_log (email,id_result,ip_address,logon_date) values (?,?,?,?)
2023-09-14 22:03:45.838 [http-nio-8080-exec-3] WARN  c.z.h.p.ProxyConnection - HikariPool-1 - Connection com.exasol.jdbc.EXAConnection@1b5a23ad marked as broken because of SQLSTATE(0A000), ErrorCode(0)
com.exasol.jdbc.NotImplemented: Feature not supported - Auto-generated keys.

and not mentioning “native”.

The Dialect no longer having sequence related supportsFns.

public boolean supportsPooledSequences() { return true; }

public boolean supportsSequences() {return false;}

I hope you guys will have any idea how to trigger native IDENTITY at database.


Identity column support is defined through the #getIdentityColumnSupport() method and the IdentityColumnSupport interface. Similarly, sequence support is defined through the #getSequenceSupport(), #getQuerySequencesString() and #getSequenceInformationExtractor() methods. Finally, the strategy to choose for native identifier generation is defined with #getNativeIdentifierGeneratorStrategy().

I suggest you look at how other dialects that are already implemented in Hibernate ORM manage that to figure out how to port it to your case.

thanks all of your help. At this stage I have a version of custom exasol dialect for hb6. The issue with IDENTITY not resolved. Fyi: same exasol-jdbc 7.1.20 with HB5, does not complain against “Unsupported - AutoKeys”.

Can you please link me with custom dialect team, or may I ask you to pass the two easy files to them to review?
How can I provide the two exasol dialect files (Dialect and IdentityColumnSupport)? (22K in a ZIP file)

many thanks,

You can create a pull request for integrating the dialect into the hibernate-community-dialects module and we’ll merge it if it compiles fine, but IMO it would be best if you talk to Exasol directly about this and make sure they maintain the dialect for you since you seem to be a customer of their product.

hi, thanks for hints and ideas. At this stage I have also contacted to Exasol, and got an in general we are looking after kind of reply, and a warning the exasol-hibernate GIT project is not supported. But I still hope they will look after as a I have also sent them the reworked Dialect files. So not sure, what to expect. Let’s wait bit, and if no exa contact, then I pass you guys the code if you want to include.

1 Like