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