Hibernate throws org.hibernate.MappingException: No Dialect mapping for JDBC type: -9 with Oracle dialect

Hi,

I have upgraded our Oracle Type 4 - pure Java driver from older version to ojdbc8.jar. This is needed for Oracle 12c R2 compatibility as well as JDK 8 compatibility.

However, the code which was working with earlier driver now starts failing while reading NVARCHAR columns through plain SQL queries. Here are the details:

  1. I am using session.createSQLQuery(…) to execute plain SQL query
  2. I am applying setResultTransformer(new AliasToBeanResultTransformerExt(SomeEntity.class)); on top of SQLQuery
  3. This query execution fails for SQL which reads NVARCHAR columns with wxception
    setResultTransformer(new AliasToBeanResultTransformerExt(AssignableSync.class));
    org.hibernate.MappingException: No Dialect mapping for JDBC type: -9

How to resolve this error?

I am using org.hibernate.dialect.Oracle10gDialect for Oracle 12.2 database and using Hibernate version of 3.5.1

I am using org.hibernate.dialect.Oracle10gDialect for Oracle 12.2 database and using Hibernate version of 3.5.1

You need to upgrade to Hibernate 5.1, 5.2 or 5.3, and most likely the issue is already fixed.

Hibernate 3.5 is too old and no longer maintained for many years now.

Thanks.
Just wondering and curious how it was working with ojdbc7 and even with ojdbc5 jars.

Just wondering and curious how it was working with ojdbc7 and even with ojdbc5 jars.

You can debug it to see how it was working. However, it does not really matter because Hibernate 3.5 was not meant to support JDBC 4.2, hence you need to upgrade anyway.

Ok. Thanks for quick reply.