Erik
Erik

Reputation: 12110

Does @Transactional open a Session and binds it?

If I annotate a method that is executed in a thread with @Transactional, will a Session be created and bound to the thread?

Upvotes: 2

Views: 364

Answers (1)

Bozho
Bozho

Reputation: 597016

Yes. The proxy (TransactionInterceptor) is around the service, so for each invocation of a service method it will start a thread-local transaction.

I would advise you to use spring 3 @Async so that you leave the thread creation to the container (spring).

Upvotes: 4

Related Questions