-->
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: HQL Vs SQL in Hibernate
PostPosted: Mon Dec 01, 2008 7:15 am 
Beginner
Beginner

Joined: Wed Nov 19, 2008 6:39 am
Posts: 44
Location: Mumbai, India
Which is good in hibernate HQL or SQL? When we can choose HQL? When we can choose SQL?

_________________
Thx,
Murugesan.
Web: http://www.murugesanpitchandi.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2008 10:00 am 
Newbie

Joined: Fri Oct 10, 2008 11:17 am
Posts: 9
It doesn't matter too much - pick whatever you feel more comfortable with.

Personally, I find HQL to be overly fussy with case-sensitivity, but if you want your SQLs to be database independent, use HQL (or write ANSI-standard SQL).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2008 9:21 am 
Newbie

Joined: Thu Dec 04, 2008 9:00 am
Posts: 1
I don't see any reason why you would want to make SQL standard practice.
If you use HQL, you can still fall back to SQL in those rare cases where you can't solve your problem with HQL.

Apart from that I simply prefer HQL over SQL cause of it's object-oriented syntax. And you don't need to specify how you want to join only THAT you want to join. (Hibernate knows how to join from the mapping.)

E.g.:
select c from Parent p join p.children c


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.