Hi ,
I am able to relsove this prblm.Here are steps.
1. Keep your loop of iteration in service not in DO.
2. Remove the AOP property for the service from ApplicationContext.
3. Create a property of txManager bean under the bean of your service .
4. Create definition of Transaction as follows in the method where we want to set the transaction boundary.
Public void insertData()
{
DefaultTransactionDefinition df = new DefaultTransactionDefinition();
df.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
TransactionStatus ts = txManagerBean.getTransaction(df);
boolean transcationCommitted=false;
try
{
Execute code of insert
}catch(Exception e)
{
txManagerBean.rollback(ts);
transcationCommitted=true;
}
if(!transcationCommitted)
txManagerBean.commit(ts);
}
5. This way we can achieve the transaction condition at the method level.
Hope this will help you