springhibernateannotationstransactionalhibernate-session

spring transactional nested open session?


If a method of service is marked as @Transactional with propagation nested, and inside it there are many calls to other @Transactional methods, each one of these methods will use its own session? It should represent many connections to db for just one method call no?


Solution

  • It looks like PROPAGATION_REQUIRED is better option for your purpose. From its javadoc:

    Support a current transaction; create a new one if none exists.

    Refer this link for more details