I am trying to work on a small program where I can connect to multiple databases using Spring and trying to use Spring transactions by deploying my web-application on weblogic s
Try adding below in spring-config.xml
:
<context:component-scan base-package=“your.packagename.contatining.EmployeeDetailsDao” />
<mvc:annotation-driven />
and changing @Transactional
in your CommonEmployeeService
with @Transactional(rollbackFor=Exception.class, propagation=Propagation.REQUIRED)
as below
@Service
public class CommonEmployeeService {
@Autowired
EmployeeDetailsService detailsService;
@Autowired
EmployeeService service;
@Transactional(rollbackFor=Exception.class, propagation=Propagation.REQUIRED)
public boolean insert(Employee e, EmployeeDetails details) {
service.insert(e);
detailsService.insert(details);
return true;
}
}