Spring Hibernate Session Problem

Once developing a Spring application you might stumble across the problem ‘ No Session found for current thread’.

The obvious answer is that the service does not have the @Transactional annotation when using the dao. However this is a hard to forget step.

But this problem might occur when the controller tries to access the dataService.
How come since the custom UserDetailsService that you have implemented (which uses hibernate by the way) works fine?

The problem is that when you have more than one application context files (just like having a child context for the DispatcherServlet) the configuration should be applied since you are going to use hibernate.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.