Oracle11g:no dialect mapping for JDBC type:-9 solution

Source: Internet
Author: User

Problem Source: Idiot leader does not work


It was a hard job.


Changed a field length from VARCHAR2 (50) to nvarchar (100)


As a result of the dialect problem, the program does not come up


The field type is also not changed back.


Nnd error is as follows:

Solution Solutions

Since the hibernate4.2.0 and oracle10g databases are used in conjunction with custom dialects, it is necessary to make a distinction between the old version and the original oracle10gdialect without registering the nvarchar and NCLOB data types,

The two java.sql.Types correspond to the type encoding 9 and 2011, the other types can refer to table 1 below, the solution is missing what type is in the custom dialect class to register which type, and determine the type in the standardbasictypes resolution.

Step 1:

Write a custom dialect class that inherits the original Oracle10gdialect dialect and registers the missing type

 Packagecc.dfsoft.uexpress;Importjava.sql.Types;ImportOrg.hibernate.dialect.Oracle10gDialect;Importorg.hibernate.type.StandardBasicTypes;/*** Created by Luxd on 2018/1/19. * Inherit Oracle dialect classes and redefine the types of Oracle field types mapped to Java*/ Public classMyoracledialectextendsoracle10gdialect{ PublicMyoracledialect () {Super();    Registerhibernatetype (Types.nvarchar, StandardBasicTypes.STRING.getName ()); }}
Step 2:

Change Hibernate database profile to change the database dialect to just the custom dialect class

#hibernate. Dialect=org.hibernate.dialect.oracle10gdialecthibernate.dialect=cc.dfsoft.uexpress.myoracledialect
Various data type numbers are as follows

Oracle11g:no dialect mapping for JDBC type:-9 solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.