I'm working with two databases (MySQL and HSQL), so I need two transaction managers in my Spring app. Please have a look at this code:
I want ClientServiceHSQL and ClientServiceMySQL to perform doSomething() on different databases, but I'm getting "org.hibernate.HibernateException: No Session found for current thread" exception. It seems that @Transactional annotation doesn't affect inherited methods. At this time I have to implement doSomething() in each @Transactional class to be able to call doSomething() with success, but for me this is not nice. Is there any way to make inherited methods also transactional?Code:public abstract class ClientService implements IClientService{ public void doSomething(){ } } public interface IClientService{ void doSomething(); } @Transactional("txManagerHSQL") public class ClientServiceHSQL extends ClientService{ } @Transactional("txManagerMySQL") public class ClientServiceMySQL extends ClientService{ }


Reply With Quote
