how to check if a data exist on a table using hibernate

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2011-06-24T14:29:16Z Indexed on 2011/06/24 16:22 UTC
Read the original article Hit count: 143

Filed under:
|
|

im using hibernate with my jsp page and mySQL ,how can i do that select * from student wher userName = *** with HQL

and how i chek if that username exist in 'Student' table ?

in my sql i use that

ResultSet resultat = statement.executeQuery();

if (resultat.next()) { ....}

i try this

Session hibernateSession = MyDB.HibernateUtil.currentSession(); 
hibernateSession.find("select xxx from Etudinat where p.Nom=xxxx");

thats give an exception so how can i do that ?

i have a login form send me a username and password

i want to chek if that username exist in the table Student to set the user on a session

what is the safty way to do that

© Stack Overflow or respective owner

Related posts about mysql

Related posts about hibernate