Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query.uniqueResult() or session.get or session.load()

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i read that if we need to get instance from database which we know primary key we can use these three ways

1)query.uniqueResult()
2)session.get
3)session.load()
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samanthi perera wrote:i read that if we need to get instance from database which we know primary key we can use these three ways

1)query.uniqueResult()
2)session.get
3)session.load()


Yep that is true. Do you have a question?

Mark
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.
I need what are the best and why ?
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session.get is clearly the best.

It requires typing in the fewest letters.

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic