-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Lazy Loading + after_transaction doesn't release connection
PostPosted: Tue Mar 20, 2012 3:45 pm 
Newbie

Joined: Tue Mar 20, 2012 3:29 pm
Posts: 1
I've run across an issue with hibernate's lazy association loading in combination with connection.release_mode="after_transaction".

For our use case we use a hibernate session per conversation pattern to support lazy loading association and deal with ajax calls.

The root of this issue appears to be covered in the following bug report from 2 years ago: https://hibernate.onjira.com/browse/HHH-4808

We use explicit transactions around operations involving writing to the database at the service layer and do not wrap entire web requests in transactions for several reasons. This means that the lazy loading that often happens when the view is rendered is always outside an explicitly defined transaction boundary.

As mentioned in the bug report, regular queries executed outside a transaction do release their connections after the query, it appears to be only lazy loading queries that do not behave this way.

The end result for us is that the connections in the underlying connection pool get exhausted when a lazy load happens but the user doesn't do anything that would result in the explicit closing of the conversation. We have to wait for the conversation timeout to trigger, which closes the session and finally releases the connection.

A simple example case is a page displaying a data table of and entity in rows with basic properties in columns and a detail button that when clicked makes an ajax call to rendered some details about row in a dialog box. Since the details for every row are not generally needed we setup our entities to lazy load those details only when they are needed. As soon as this happens though, we have a hanging connection that will not close until the hibernate session is closed, which depending on user action can easily be 10-15 minutes later when the conversation times out.

Is there a work around for this issue?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.