spring 3.0+hibernate 3.x 升级到spring 3.2+hibernate 4.x

1.sessionFactory

<bean id="sessionFactory"  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
改为
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

2.transaction

<bean id="hibernateTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
改为
<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">

3.spring 3.2去掉了hibernateTemplate

4.对lob字段的支持,spring3.2去掉了对lobHandler,hibernate 4提供了对lob字段的支持

使用hbm.xml:
将type由org.springframework.orm.hibernate3.support.ClobStringType和org.springframework.orm.hibernate3.support.BlobByteArrayTypes
改为
hibernate 4自带的新类型org.hibernate.type.MaterializedClobType 和 org.hibernate.type.MaterializedBlobType

使用注解:@Lob

参考文档:https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_Application_Platform/6/html/Migration_Guide/Migrate_Your_Hibernate_33x_Application_to_Hibernate_4x.html

猜你喜欢

转载自breath.iteye.com/blog/1828949
今日推荐