-->
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: 4.X get a preparedStatement from session
PostPosted: Fri Dec 13, 2013 7:09 am 
Newbie

Joined: Thu Jun 07, 2012 5:12 am
Posts: 3
Hello, I'm using hibernate 4.2 and it is hard to me to get a preparedStatement (old Tests to maintain that use this).

I've tried this
http://www.java-forums.org/advanced-java/19017-preparedstatement-hibernate-session.html
but at runtime, my "create table" query is unsupported.

Any code to get a preparedStatement?


Top
 Profile  
 
 Post subject: Re: 4.X get a preparedStatement from session
PostPosted: Mon Dec 16, 2013 10:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Assuming you specifically trying to use the same Connection used by Session, the intended way is:

Code:
session.doWork(
    new Work() {
        public void execute(Connection connection) throws SQLException {
            connection.prepareStatement( ... );
        }
    }
);


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.