Oracle org.hibernate.MappingException: No Dialect mapping for JDBC type: -9

I started receiving this message when some one changed the column type in Oracle from varchar2 to nvarchar2. The dialect I’m using is “org.hibernate.dialect.Oracle10gDialect”. Switching it back to varchar2 fixed the problem.

Digging further into Hibernate source code, I found an alternate approach. That would be to create a custom dialect. This solution takes 5 minutes. Here is the source code for custom dialect:


public class CustomeOracleDialect extends Oracle10gDialect
{
public CustomeOracleDialect()
{
registerHibernateType( Types.NVARCHAR, Hibernate.STRING.getName() );
}

}

Advertisements

5 Responses to Oracle org.hibernate.MappingException: No Dialect mapping for JDBC type: -9

  1. carl roberts says:

    OK, how did you solve it?

  2. carl roberts says:

    Thanks.

    I will test it tonight.

    • carl roberts says:

      It works when I use this property in persistence.xml after duping your code as a new class:

      But, does this fix disable UTF-16?

      • suneel says:

        This shouldn’t as this code treats the data as java.lang.String, which can be used to store any kind of unicode encoding. Please do let me know if I am wrong.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: