hibernate报错:org.hibernate.MappingException: No Dialect mapping for JDBC type: -1

解决方法:自定义一个Hibernate Dialect.

hibernate报错:org.hibernate.MappingException: No Dialect mapping 
for JDBC type: -1
package com.yourcompany.util ;  
  
import java.sql.Types;  
  
import org.hibernate.Hibernate;  
import org.hibernate.dialect.MySQL5Dialect;  
  
public class CustomDialect extends MySQL5Dialect {  
    public CustomDialect() {  
        super();  
        registerHibernateType(Types.DECIMAL, Hibernate.BIG_DECIMAL.getName());  
        registerHibernateType(-1, Hibernate.STRING.getName());  
    }  
}  
hibernate报错:org.hibernate.MappingException: No Dialect mapping 
for JDBC type: -1

然后将hibernate配置文件(或是Spring配置文件)中配置数据库方言的那一项,改成上面自定义的方言

<property name="hibernate.dialect">  
      com.yourcompany.CustomDialect  
</property>  

 

hibernate报错:org.hibernate.MappingException: No Dialect mapping for JDBC type: -1,布布扣,bubuko.com

hibernate报错:org.hibernate.MappingException: No Dialect mapping for JDBC type: -1

上一篇:[android] Activity 的生命周期 以及横屏竖屏切换时 Activity 的状态变化


下一篇:Android 之 下拉框(Spinner)的使用