• Post Reply Bookmark Topic Watch Topic
  • New Topic

retrive data

 
madhuchilipi reddy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am writing in sql my query is "select max(sid) from Student" this is my query.
how i write same query using HQL
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its written pretty much the same as you would in SQL:

However, why do you want the max id? I would normally expect an aggregate function to be used on a numeric property, not the primary key?
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!