hql - How to write a query in hibernate for count(*) -


i want execute below query in hibernate?

select count(*) login emailid='something' , password='something'

suppose login table mapped loginclass class, emailid , password instance variables. you'll execute like:

query query = session.createquery(         "select count(*) loginclass login login.emailid=:email , login.password=:password"); query.setstring("email", "something"); query.setstring("password", "password"); long count = (long)query.uniqueresult(); 

it should return in count result you're looking for. have adapt name class , parameter names.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -