-->
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.  [ 2 posts ] 
Author Message
 Post subject: Call stored procedure when connection assigned to session
PostPosted: Mon Sep 22, 2008 11:37 am 
Newbie

Joined: Fri Sep 29, 2006 10:52 am
Posts: 6
Hibernate version:
3.2.6 GA

Hi

I am using glassfish with hibernate. I am trying to call a stored procedure when a connection is associated with a session. The purpose is to set session information on the pooled connection. If possible I would like to clear the information when the connection is released again.

I played around with the session event listeners, but that seems a bit wrong in this situation as I would need one for load, saveOrUpdate etc, unless there is something like open session event?

Is there a better way to achieve what I am trying to do?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 6:15 am 
Newbie

Joined: Fri Sep 29, 2006 10:52 am
Posts: 6
I found the following class
Code:
org.springframework.orm.hibernate.HibernateInterceptor


Is it possible to do something similar if I am not using Spring? it is an EJB3 application.

Currently I have replaced ConnectionProvider by specifying a custom one in the hibernate properties. Unfortunately I cannot see if the session information has been set on the connection or not. Wouldn't want to do it every time a connection is provided as it happens multiple times per transaction.

Does a session hold onto one connection or does it use and release back into the pool?
Does a transaction hold onto one connection or does it use and release back into the pool?

I would imagen that one connection is held onto, at least for a transaction, but would appreciate someone confirming/denying/or explaining this to me.

I got it to work in Glassfish by replacing the DataSource with a custom implementation, the problem is the app has to work on JBoss as well and JBoss does not allow me to replace the DataSource for a local tx.

Any suggestions would be appreciated.


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

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.