Announcement Announcement Module
No announcement yet.
Using openSessionInViewFilter but session is closed Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using openSessionInViewFilter but session is closed


    I'm using Spring Hibernate in a Webapplication. To load persistent Objects I use HibernateDaoSupport.

    But in my Business Objects I've 1:Many Relations declared with FetchType.LAZY. So the Collection is not loaded in the dao but somewhere in my presentation Layer. Unfortunately without hibernate session.

    I've googled and found a solutions : the OpenSessionInViewFilter.

    I've defined like this:

        <!-- Spring filters -->
    and it seems to work. The filter is processed for the requests.
    Sadly there is still the error 'no session or session was closed'.

    One relation I use is the Object Log has Many LogEntries. This is defined as Lazy. When I debug my Code I see, that in this line

    public Set<LogEntry> getLogEntries() {
            return logEntries;
    logEntries is an instance of PersistentCollection (that's clear) and in the Collection the session the flag closed is set to true.

    Do I have to tell my business objetct which session to use?

    Thanks for your help.