• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding session.load()

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have read that we can load a class using

session.load

For example :

User us = session.load(User.class, some key);

How can i use this within a HQL ? Query query = session.createQuery(myhqlquery);??

Please help
 
Javid Jamae
Author
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session.load and HQL are two different ways of loading objects. If you have the primary key, use session.load() or session.get(), if you need to load one or more objects using parameters besides the primary key, use HQL or Criteria queries.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks JJ
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic