Thank you a lot Ashok. I will try.
2007/5/17, Ashok Madhavan <[EMAIL PROTECTED]>:
Hi Sergey,
If you are using Spring + iBatis, you can go with Declarative transaction
supprt provided by spring. Then u dont need to do any of the
startTransaction() or endTransaction().
<bean id="txManager" class="
org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="your_data_source_here"/>
</bean>
<!-- Transaction Attributes for the Method Signatures -->
<bean id="txAttributes" class="
org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource
">
<property name="properties">
<value>add*=PROPAGATION_REQUIRED
insert*=PROPAGATION_REQUIRED
update*=PROPAGATION_REQUIRED
delete*=PROPAGATION_REQUIRED
move*=PROPAGATION_REQUIRED
</value>
</property>
</bean>
<!-- Transaction Incerceptor -->
<bean id="matchAllTxInterceptor"
class="
org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="txManager"/>
<property name="transactionAttributeSource" ref="txAttributes"/>
</bean>
<!-- BeanNameAutoProxyCreator handles all beans where we want all
methods to use PROPAGATION_REQUIRED -->
<bean id="autoProxyCreator"
class="
org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="interceptorNames">
<list>
<idref local="matchAllTxInterceptor"/>
</list>
</property>
<property name="beanNames">
<list>
<idref local="your_dao_here"/>
</list>
</property>
</bean>
<bean id="your_dao_here" class="dao_class_here">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="sqlMapClient"><ref local="sqlMapClient"/></property>
</bean>
regards
Ashok
On 5/17/07, Sergey Livanov <[EMAIL PROTECTED]> wrote:
>
> Mark, thank you a lot for answer.
> I want to do something like
> try{
> sqlMap.startTransaction() ;
> sqlMap.insertHeader( headerbean );
> sqlMap.insertItems( ListOfItems) ;
> sqlMapcommitTransaction() ;
> } finally {
> sqlMap.endTransaction() ;
> }
>
>
>
>
>
> 2007/5/17, Mark Volkmann <[EMAIL PROTECTED]>:
> >
> > On May 17, 2007, at 10:34 AM, Sergey Livanov wrote:
> > > I use Spring Dao + iBatis and I have to run into the one transaction
> >
> > >
> > > inserts order document.
> > > ( insert into header values( docpk, docnum, docdate, client ) and
> > > many inserts as insert into( docfk, itempk, good, price, quantity ).
> > >
> > > I do not know how to create one transaction in the case of spring
> > dao,
> > >
> > > And I do not know how to enter data for items by the iterates.
> > > Help me please.
> >
> > I'm not sure if I understand the issue you are trying to solve, but
> > maybe my notes will help. I have notes on setting up declarative
> > transaction management with Spring at http://www.ociweb.com/mark/
> > programming/SpringTransactions.html.
> >
>
>