-->
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: hql query
PostPosted: Fri Jul 22, 2005 1:23 am 
Newbie

Joined: Fri Jul 22, 2005 1:16 am
Posts: 1
Location: Bangalore,India
Hi,

I am very new to hibernate world. I am facing problem with hql queries.

Could you send me an equal query to the following sql query.

"Select RL_ID from REP_LOG where USER_ID = 1234"

Thanks,
Varaprasad.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 1:59 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Map your REP_LOG table to a class called REP_LOG. Make sure the class has properties called RL_ID and USER_ID and map them to this columns.
This way your HQL looks exactly like the SQL.

The big difference is, that the SQL (called via JDBC) gets you a resultset, everything else you have to do yourself (read it, take some actions, create new SQLs and so on).
With Hibernate and HQL you get Java objects. You can change them, create new ones (Sessin.save) delete them (Session.delete) and Hibernate does the rest (all the JDBC stuff) for you.

HTH
Ernst


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.