why Spring JPA2.3.1 and hibernate 5.1.2 GenerationType.IDENTITY with spring.jpa.hibernate.use-new-id-generator-mappings= false configuration is using hibernate_sequence table for id generation ideally it should use MS SQL sever primary key auto increment id .

When we were using spring JPA with single data based(SQL server) it was working fine and used SQL server table id auto increment for any new save/insert, it was incrementing ids and never used hibernate_sequence but as soon as we introduce one more database oracle data source it started malfunctioning and using hibernate_sequence for any new insert in MS SQL server hence started generating id from 1 where existing table id max value is 900.

As this application is already there in production with MS SQL server auto increment id so would like to avoid using hibernate_sequence to avoid id generation from 1 and at the same time we would like to connect to Oracle DB to read some tables.

So what should be spring boot 2.3.1 and hibernate 5.1.2 equivalent configuration which connect to oracle(read only) and SQL server(Insert with table auto increment id) to use MS SQL Server auto increment id rather then hibernate_Sequence as described above

Note :-We have already used Identity as id strategy and set config spring.jpa.hibernate.use-new-id-generator-mappings= false but still hibernate 5 is using hiberante_sequence instead of relying SQL auto increment id.

so I am looking for solution where Spring JPA 2.3.1 should not use hibernate_sequence and rely on SQL server auto increment id as following solution does not work for multi data source scenario. Table 'DBNAME.hibernate_sequence' doesn't exist

0

There are 0 best solutions below