GavinLas2
Sep 28th, 2004, 03:45 AM
Hello,
I have Hibernate set up via Spring as follows... I would like to set up ibatis so I can use both libraries in my daos. What do I need to do to configure ibatis to use hibernate connections and transactions. What else do I need to share between these 2 frameworks.
Thanks
<!-- Hibernate -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFact oryBean">
<property name="configLocation"><value>/hibernate.cfg.xml</value></property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransac tionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="dao"
class="org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean"
lazy-init="true">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="oneDao" parent="dao">
<property name="target">
<bean class="dao.service.OneDaoImpl">
<property name="sessionFactory"><ref bean="sessionFactory"/></property>
</bean>
</property>
</bean>
I have Hibernate set up via Spring as follows... I would like to set up ibatis so I can use both libraries in my daos. What do I need to do to configure ibatis to use hibernate connections and transactions. What else do I need to share between these 2 frameworks.
Thanks
<!-- Hibernate -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFact oryBean">
<property name="configLocation"><value>/hibernate.cfg.xml</value></property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransac tionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="dao"
class="org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean"
lazy-init="true">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="oneDao" parent="dao">
<property name="target">
<bean class="dao.service.OneDaoImpl">
<property name="sessionFactory"><ref bean="sessionFactory"/></property>
</bean>
</property>
</bean>