This class must inherit the dialect class corresponding to the database we use. For example, if we use MySql (version 5. x. x), we need to inherit from "org. hibernate. dialect. mySQL5Dialect "; if we use DB2, we should inherit" org. hibernate. dialect. DB2Dialect "; I use Oracle10g, so I want to inherit" org. hibernate. dialect. oracle10gDialect"
In oracle10g, the time and minute are automatically lost, which is an ojdbc driver problem. Therefore, we need to customize the dialect or upgrade the driver.
By default, when the hibernate ing type is java. SQL. Date, you can configure java. SQL. Timestamp for this column.
[Java]
Public class RegisterType extends Oracle10gDialect {
Public RegisterType (){
// TODO Auto-generated constructor stub
Super ();
RegisterHibernateType (Types. CHAR, Hibernate. STRING. getName (); // convert the char type of the database to the String type.
// RegisterHibernateType (Types. DATE, Hibernate. TIMESTAMP. getName ());
// RegisterHibernateType (Types. DECIMAL, Hibernate. BIG_DECIMAL.getName ());
RegisterHibernateType (-1, Hibernate. STRING. getName ());
}
}
Your Oracle uses the decimal type, and the error should be No Dialect mapping for JDBC type: 3. note that this 3 indicates that hibernate cannot map this data type to your java class. it must be used in a custom Dialect:
RegisterHibernateType (Types. DECIMAL, Hibernate. BIG_DECIMAL.getName ());
Register your dialect to hibernate. cfg. xml
[Java]
<Prop key = "hibernate. dialect"> org. zjf. util. RegisterType </prop>