Hi I am new to hibernate and struts2 and I have created the project whiich contains user registration page , in which the fields are firstnaem,middlename,lastname and emailid.Now in this I have to check that
emailid should be unique for each user so no duplicates can be provided.
Can anyone tell how can I check this through database in hibernate .
I agree with Manish, If you are trying validate that email id entered by new user does not already exist in database, you shall have to make a DB call. You can fire the query to get the number of rows in the table having same email id, as passed by the new user, if the result is zero the email id has not already been used.
You can use various ways like Criteria, HQL, Detached Criteria, named query or native query to implement the query.