-->
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: using native SQL in hibernate
PostPosted: Thu Aug 03, 2006 4:39 am 
Newbie

Joined: Thu Aug 03, 2006 4:30 am
Posts: 1
Location: Bangkok
Hello all,
I am new to Hibernate and also this Forum.
can anyone tell what is the difference if I use native SQL using "session.createSQLQuery()" and use of JDBC Connection using "session.connection()" ??

is there any performance issue or anything else?

Thanks in advance

_________________
Regards,
Chandra


Top
 Profile  
 
 Post subject: JDBC and Hibernate
PostPosted: Thu Aug 03, 2006 12:48 pm 
Newbie

Joined: Wed Aug 02, 2006 2:58 am
Posts: 7
Session.connection returns an javax.sql.Connection through which one can create either statement or prepared statement manually and manage jdbc transaction manually as well.

Where as in Hibernate the SQLQuery object's query will depend how the sql string is created. If the string is created with parameters in that case the statement internally created by hibernate is a prepared statement and if the query is hitting the DB relatively more frequently that other queries than it is benefecial otherwise not as it will take a lot of space.
On the other if the query string is formed of string concatenation than it will be normal jdbc statement. Further you can manage the transaction from hibernate of Spring .

I think you will get the rest of the picture from here on. Let me know if you find anything interesting

Thank you.


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.