Error saving entity with identity id and globally quoted identifiers on Oracle 12c

Description

Entity insert fails on Oracle 12c database when trying to use IDENTITY id generation strategy with hibernate.globally_quoted_identifiers=true.

Entity:

hibernate.properties:

DDL:

Code example:

Error:

The same works fine if I set

and change DDL correspondingly to:

When debugging the error I noticed that oracle.jdbc.driver.AutoKeyInfo#getReturnParamTypeCode tries to find "id" (with quotes) in an array of columns without quotes oracle.jdbc.driver.AutoKeyInfo#tableColumnNames. The array must be retrieved directly from database by the driver itself (to prove that I added a new column Hibernate is not aware about and that column was included into the array) and the quoted column must be coming from Hibernate.

Note that with the same driver version and DDL (with and without quotes) I am able to run native queries via java.sql.Connection#prepareStatement.

Also when I tried lowercase table name @Table(name = "company") with global quoting option and corresponding changes in DDL have been made I got another error:

Even though the errors seem to be different they might have something in common.

Environment

hibernate-core-5.3.7.Final
ojdbc8.jar
Oracle Database 12c Release 12.2.0.1.0
jdk1.8.0_172

Assignee

Unassigned

Reporter

Kryvda

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure