Q:

how to use transaction manager in spring 3

i tried using this in spring 3 xml file but it gives error
<tx:annotation-driven transaction-manager="transactionManager" />

what thinga are required for this to work

A:

You need a transactionManager, e.g., 
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

Which requires a SessionFactory which in turn requires a 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 also need to declare your transactions. I personally prefer the declarative transaction approach where you simply annotate your database routines with @Transactional. 

