-->
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.  [ 5 posts ] 
Author Message
 Post subject: Can hibernate execute JDBC SQL directly?
PostPosted: Thu Sep 09, 2004 5:04 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
Hi everyone:

I want to know if hibernate can execute jdbc SQL directly.For example,I want to execute a sql query like
Code:
"insert into tablename values('343','test','hello');"
or
Code:
"update tablename set... ...,set...".
Can hibernate support it ? If it can how to do? I find that the Session object don't give me such method. Could someone give me an idea?

_________________
You are not alone...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 5:29 am 
Regular
Regular

Joined: Thu Aug 05, 2004 2:27 am
Posts: 54
Location: South Africa
try session.createSQLQuery


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 7:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Correction:

createSQLQuery is for *Querying*, not data manipulation.

To do the above simply use the jdbc Connection available via the connection() method on Session.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 8:24 am 
Regular
Regular

Joined: Thu Aug 05, 2004 2:27 am
Posts: 54
Location: South Africa
max wrote:
Correction:

createSQLQuery is for *Querying*, not data manipulation.

To do the above simply use the jdbc Connection available via the connection() method on Session.


thank you, still learning something daily here


Top
 Profile  
 
 Post subject: Thks
PostPosted: Thu Sep 09, 2004 7:30 pm 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
max wrote:
Correction:

createSQLQuery is for *Querying*, not data manipulation.

To do the above simply use the jdbc Connection available via the connection() method on Session.


Thank you .You mean that I can't using this method for insert a record directly. I have to get a connection and get a resultset using this connection.

_________________
You are not alone...


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