标签:io ar os java sp 文件 on bs ef
package com.gstone.history.entity;
import java.sql.Types;
import org.hibernate.Hibernate; import org.hibernate.dialect.MySQLDialect;
public class BlobMySQLDialect extends MySQLDialect{ public BlobMySQLDialect(){ super(); registerHibernateType(Types.LONGVARBINARY, Hibernate.BLOB.getName()); } }
然后在配置文件中,改方言:
<prop key="hibernate.dialect">
com.gstone.history.entity.BlobMySQLDialect
</prop>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="packagesToScan" value="com.gstone"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.dialect">
com.gstone.history.entity.BlobMySQLDialect
</prop>
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">
spring/ehcache.xml
</prop>
</props>
</property>
</bean>
标签:io ar os java sp 文件 on bs ef
原文地址:http://www.cnblogs.com/lyming/p/4088746.html