hibernate-reactive icon indicating copy to clipboard operation
hibernate-reactive copied to clipboard

Default array mapping doesn't work for Oracle

Open DavideD opened this issue 1 year ago • 6 comments
trafficstars

For Oracle, Hibernate ORM define custom types to map arrays. We can create the same types with Vert.x SQL client but when we try an insert we have an exception.

Vert.x doesn't support user types at the moment: https://github.com/eclipse-vertx/vertx-sql-client/issues/1392

We test arrays in JavaTypesArrayTest

We've created a PR for Vert.x that should be able to help us fix this issue, but we are waiting for the team to review it.

DavideD avatar Dec 14 '23 13:12 DavideD

I don't think it's the right approach, but we should check if this solution is doable and solve the issue.

DavideD avatar Jan 17 '24 17:01 DavideD

@DavideD debugged array test with Oracle DB today. The ResultSetAdapter ends up finding a ReactiveOracleArrayJdbcType instance but isn't processing it completely, so I'm hoping it isn't a big fix.

blafond avatar Feb 07 '24 21:02 blafond

@blafond, make sure to check the chat I had with Thomas: https://github.com/eclipse-vertx/vertx-sql-client/issues/1392

I'm not sure how this array is created, but we need to do the same: https://github.com/hibernate/hibernate-orm/blob/d90d6e63f017b5ebe4294b5850e0fad155acdd4f/hibernate-core/src/main/java/org/hibernate/dialect/OracleArrayJdbcType.java#L114

DavideD avatar Feb 08 '24 10:02 DavideD

@DavideD ORM's OracleArrayJdbcType utilizes the actual Oracle connection & driver which calls OracleConnection.createOracleArray() interface into Oracle's PhysicalConnection.createOracleArray()

Vertx connection framework only implements it's own connection hierarchy ending up with an OraclePool and OracleConnection interfaces that don't do much except managing connection and facilitating queries and results.

I'm not finding a path to get the actual DB connection through Vertx... which I wouldn't expect I guess.

blafond avatar Feb 13 '24 20:02 blafond

note that ReactiveOracleArrayJdbcType.getArray(...) is the proper place to convert the array. I was able to get a vertx OracleConnection however there were no methods to help us.

blafond avatar Feb 13 '24 20:02 blafond

OracleConnection however there were no methods to help us.

What do you mean? This is the method we need to call: https://docs.oracle.com/en/database/oracle/oracle-database/21/jajdb/oracle/jdbc/OracleConnection.html#createARRAY_java_lang_String_java_lang_Object_

DavideD avatar Feb 14 '24 08:02 DavideD