-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to fire static sql before doing work on session
PostPosted: Wed Aug 09, 2006 3:50 pm 
Newbie

Joined: Thu Jun 30, 2005 10:35 am
Posts: 13
Hi, I have a fairly simple question that I'm hoping someone can help me with... We decided to use Oracle Workspace Manager for our current project and so now I need to have a static sql statement fired right after opening any session which just connects a use to the correct workspace. The sql statement itself isn't important but I was just wondering how I fire an sql statement through hibernate without doing a load or anything. I looked into the hibernate Query and SQLQuery but both seem to only have an option for firing a query when loading objects and returning something.

Other than just knowing how to fire a static sql, I was wondering if there is a particularly nice way to do this via the config file or something along those lines, instead of directly in the daos...

Thanks in advance for any help!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 4:20 pm 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
You will need to obtain the JDBC Connection via session.connection() after you obtain it from the session factory. Execute the statement via JDBC and then carry on. As far as how to accomplish this in an easy manner, there are several architectural options I can think of off the top of my head: proxy the SessionFactory; obtain the session through your own factory class; use IoC to method inject into the SessionFactory.getCurrentSession() method. The choice really depends on your current architecture.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 11, 2006 10:30 am 
Newbie

Joined: Thu Jun 30, 2005 10:35 am
Posts: 13
Thanks a lot ananasi...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.