How exactly @Transaction works:
Earlier we used to start, close, rollback the transactions programmatically. But with the introduction of @Transaction annotation life became easy. All the underlying transaction management will he handled by the framework.
@Service
public class EmployeeService {
@Transactional
public void saveEmployee (Employee employee){
dao.saveEmployee (employee);
}
}
The underlying transaction managers handle the transaction, whichever is used, for example: HibernateTransactionManager or JpaTransactionManager