java - how to use transaction manager in spring 3 -
i tried using in spring 3 xml file gives error
<tx:annotation-driven transaction-manager="transactionmanager" />
what thinga required work
you need transactionmanager, e.g.,
<bean id="transactionmanager" class="org.springframework.orm.hibernate3.hibernatetransactionmanager"> <property name="sessionfactory" ref="sessionfactory" /> </bean>
which requires sessionfactory in turn requires datasource (here c3p0):
<bean id="sessionfactory" class="org.springframework.orm.hibernate3.annotation.annotationsessionfactorybean"> <property name="datasource" ref="datasource" /> ... </bean> <bean id="datasource" class="com.mchange.v2.c3p0.combopooleddatasource" destroy-method="close"> ... </bean>
you need declare transactions. prefer declarative transaction approach annotate database routines @transactional.
Comments
Post a Comment