datasource.hibernate.cfg.xml
有hiberanteProperties和所有映射资源。
但是现在我必须分别在applicationContext.xml
中定义映射资源和属性
我可以在configLocation
中将datasource.hibernate.cfg.xml指定为<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
并删除mappingResources and hibernateProperties
。现在我的应用程序上下文如下所示:
<property name="mappingResources"/>
<list>
<value>../../src/editsolutions.hibernate.cfg.xml</value>
</list>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.connection.isolation">3</prop>
<prop key="hibernate.current_session_context_class">jta</prop>
<prop key="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</prop>
<prop key="hibernate.transaction.manager_lookup_class">
com.atomikos.icatch.jta.hibernate.TransactionManagerLookup
</prop>
</props>
</property>
注意:我不对实体类使用注释。这是一个遗留项目,所有内容都是通过hbm.xml
定义的。