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

ReactiveDeferredResultSetAccess use ResultSetAccess interface default resolveType impl will cause NPE

Open paomian opened this issue 10 months ago • 0 comments

I'm using quarkus 3.9.3 with hibernate reactive. database is pg. When I call createNativeQuery and the query table result contains field which type is json will cause NPE. The reason I conducted a brief survey was

https://github.com/hibernate/hibernate-orm/blob/aae9b1e55d865d215070ee7d74ecc49593f83f4f/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/ResultSetAccess.java#L78-L99

columnTypeName is from this method. it must be null. https://github.com/hibernate/hibernate-reactive/blob/a8e757f772f84c59a8b21edf7a8f1d6469d11ea2/hibernate-reactive-core/src/main/java/org/hibernate/reactive/adaptor/impl/ResultSetAdaptor.java#L1352-L1356

and then call resolveSqlTypeDescriptor in PostgreSQLDialect. when jdbcTypeCode is OTHER it will cause NPE because columnTypeName is null https://github.com/hibernate/hibernate-orm/blob/aae9b1e55d865d215070ee7d74ecc49593f83f4f/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java#L308-L337

paomian avatar Apr 18 '24 13:04 paomian