Spring & Hibernate: no session bound to the thread?

Since your configuration looks fine, there are several possible reasons: You call Transactional method on the object created with new (i.e. Not obtained from Spring) You call Transactional method from another method of the same object (in this case transactional aspect is not applied since it's proxy-based) Your object with Transactional methods is declared in the context where tx:annotation-driven is not in effect (for example, your Transactional object is declared in servlet. Xml whereas tx:annotation-driven is only declared in applicationContext.

Xml ).

Since your configuration looks fine, there are several possible reasons: You call @Transactional method on the object created with new (i.e. Not obtained from Spring) You call @Transactional method from another method of the same object (in this case transactional aspect is not applied since it's proxy-based) Your object with @Transactional methods is declared in the context where is not in effect (for example, your @Transactional object is declared in ...-servlet. Xml, whereas is only declared in applicationContext.

Xml).

It is called from a Spring MVC controller, where the service is injected. None of the two first possibilities apply. As for the third:that might be it!

I'll test it out. However,I did not split configurations as spring recommends; just one root-context. Xml that imports 3 other xml's, my servlet dispatcher, hibernateconfiguration and another one for JSON.

– toomuchcs Nov 14 '10 at 20:28 thank you very much. I've been breaking my head on this issue for about 2 days. Never thought something so trivial would be it!

But i'm glad, I learnt another thing about spring that i'll never forget ;) – toomuchcs Nov 14 '10 at 20:35.

Since your configuration looks fine, there are several possible reasons.

You don't seem to have transaction configured yet... you can add the following into your Context Data Config file.

You don't seem to have transaction configured yet... you can add the following into your Context Data Config file:- Change YOUR. PACKAGE to your actual package name, for example:- execution(* com.project..*. *(..)) This is one lazy way to wrap all your methods in your project with transaction.By the way, if you are going to lazily query your bernate domain objects (ex: parent.getChildren()) in your view, then I would highly suggest you to add this into your web.

Xml:- hibernateFilter org.springframework.orm. Support. OpenSessionInViewFilter hibernateFilter /* This filter extends bernate session to the view.

1 Correct. Perhaps also consider using @Transactional notation on your DAO as an alternative to aop. – Johan Sjöberg Feb 25 at 19:49 Adding the filter thing got me rid of that error, thanks.

What is it exactly it is doing? I didn't add the transaction support yet, as I don't know what it is. – nbarraille Feb 25 at 20:09 @nbarraille: That filter ensures your view layer has access to the Keep in mind, you will need this filter AND transaction configured if you want your stuff to work properly.

Having this filter doesn't mean you have any trasaction wrapped on each user request. Read this for more info: static.springsource. Org/spring/docs/1.2.9/api/org/… – limc Feb 25 at 20:13.

For what it's worth ... run into this as well, after much looking had to modify part of web. Xml: hibernateFilter org.springframework.orm. Support.

OpenSessionInViewFilter singleSession true ... specifically had to set singleSession to true.

For what it's worth ... run into this as well, after much looking had to modify part of web.xml.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions