i have a database.xml to define spring transaction like
<aop:config proxy-target-class="true">
<aop:advisor advice-ref="txAdvice"
pointcut="execution(* com.compass.utils..*.*(..))" />
</aop:config>
and my dao,service are all in the utils package or subpackage like:
com.compass.utils.db.dao
com.compass.utils.service
if my service class is like
public class AlarmService {
@autowired
private AlarmDao alarmDao;
@autowired
private PositionDao positionDao;
@autowired
private AccountDao accountDao;
public void testService(){
alarmDao.save(a);
positionDao.save(b);
accountDao.save(c);
}
}
how many transactions are created in invoke the testService? 4 transactions?three transactions for save invoke ,and one for testService?or just one transaction?
if 4 transactions are created,how to rollback if save or testService throw exception? maybe positionDao.save(b) throw exception,just only transaction of positionDao.save rollback,and alarmDao save complete or all save rollback because of testService transaction?
if i change AlarmService package path ,make it out of com.compass.utils,like com.compass.service,what effect the transactions about my question?
when AlarmService is in com.compass.service package,and i annotation @Transactional in testService method, what effect the transactions about my question?
@Transactional can @Override the database.xml configure?
thanks for your help and suggestion in advance!