-->
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: OSIV, Two Transactions and Lazy Loading
PostPosted: Tue Apr 20, 2010 12:14 am 
Newbie

Joined: Tue Sep 29, 2009 7:42 am
Posts: 6
I'm currently making use of the Open Session In View pattern.

However, I create 2 transactions, one for the action, one for the view. I'm also making use of the thread local session context.

When I commit a transaction for the action, I need to get a new session object instead of re-using the previous session. getCurrentSession() returns me a new Session object after I commit. I assume this is the normal behavior for the thread local context configuration.

However, if I start a new transaction using this new Session, and use this transaction for the view, and the view involves lazy loading of objects, I eventually get the following JDBC connection error:

Code:
Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
.
.
.
Caused by: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found


If I switch to flushing after the action (but before the view) instead of committing, i.e. avoiding using 2 transactions, this error does not occur. I assume that lazy loading from an object that belongs to a previous transaction (and session?) is leaving the session connection open.

How can I resolve this situation?


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.