-->
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: Direct SQL operations sharing a single JDBC connection w/H
PostPosted: Thu Jan 12, 2006 2:28 pm 
Newbie

Joined: Thu Jan 12, 2006 2:09 pm
Posts: 1
I need to execute some SQL queries that modifies the data used by hibernate (DML operations). I have the following restriction: the application running as a standalone java application and it's using an embedded Apache Derby database, it allows only one connection to database, so I can't open another connection, I have to use the same JDBC connection that hibernate is using.
I also can't close the session and open it again, because the session takes about 60 seconds to start according to the application developer (another company)

I know there is a connection method in org.hibernate.Session from where I can get the underlying JDBC connection, but I'm not sure that my modifications in the database would be in conflict with some buffer or cache in memory.

I want to use the following code:

Code:
session.clear();
session.flush();
java.sql.Connection con = session.connection();
// use the connection to perform DML operations


There is no con.close() because the connection was created by Hibernate.
Are flush() and clear() method calls enough to be sure that nothing will go wrong between hibernate and the database?

_________________
--
Franco Catrin L.


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.