org.hibernate.MappingException: No Dialect mapping for JDBC type: -1 搞定!
2012-05-02 16:44
459 查看
继承于MySQLDialect ,引入 registerHibernateType(Types.LONGVARCHAR, Hibernate.TEXT.getName());
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.dialect.MySQLDialect;
public class ThisMySQLDialect extends MySQLDialect {
public ThisMySQLDialect (){
super();
registerHibernateType(Types.LONGVARCHAR, Hibernate.TEXT.getName());
}
}
hibernate 配置修改
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="connection.useUnicode">true</prop>
<prop key="connection.characterEncoding">GBK</prop>
<prop key="hibernate.dialect">com.yjf.dao.ThisMySQLDialect </prop><!-- org.hibernate.dialect.Oracle9Dialect -->
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">update</prop> -->
<prop key="hibernate.jdbc.batch_size">0</prop>
</props>
</property>
<property name="mappingLocations">
<list>
<value>classpath:com/yjf/model/hbm/*.hbm.xml</value>
</list>
</property>
</bean>
本文出自 “无证程序猿” 博客,请务必保留此出处http://yjflinchong.blog.51cto.com/6851233/1164971
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.dialect.MySQLDialect;
public class ThisMySQLDialect extends MySQLDialect {
public ThisMySQLDialect (){
super();
registerHibernateType(Types.LONGVARCHAR, Hibernate.TEXT.getName());
}
}
hibernate 配置修改
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="connection.useUnicode">true</prop>
<prop key="connection.characterEncoding">GBK</prop>
<prop key="hibernate.dialect">com.yjf.dao.ThisMySQLDialect </prop><!-- org.hibernate.dialect.Oracle9Dialect -->
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">update</prop> -->
<prop key="hibernate.jdbc.batch_size">0</prop>
</props>
</property>
<property name="mappingLocations">
<list>
<value>classpath:com/yjf/model/hbm/*.hbm.xml</value>
</list>
</property>
</bean>
本文出自 “无证程序猿” 博客,请务必保留此出处http://yjflinchong.blog.51cto.com/6851233/1164971
相关文章推荐
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1 搞定!
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1 解决方法
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -9【问题发现与解决】
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -9(-*)
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1 解决方法搜藏
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1 解决方法搜藏
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1 解决方法搜藏
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -15的解决方法
- Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: -4
- sqlserver org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -16
- org.hibernate.MappingException: No Dialect mapping for JDBC type: 3
- org.hibernate.MappingException: No Dialect mapping for JDBC type:
- hibernate报错:org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -4
- org.hibernate.MappingException: No Dialect mapping for JDBC type: -1 解决方法