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 ()); } }
Then in the configuration file, change the dialect:
<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>
MySQL dialect does not support BLOB type solutions