• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unexpected output

 
Amritpal Singh Moomie
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI I am trying to create a user check method by accessing database for my jsf application.
Can anybody tell me why i am getting login (i.e success output ) from code even when i enter wrong loginname and password?

 
Amritpal Singh Moomie
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to check whether the resultset is null or not?
If its null that is there is no record like that means fail (no login)
and if its not null that is success( successfull login)
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ResultSets are never null. They are empty sometimes though...
 
Amritpal Singh Moomie
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so how can i check that there is no record for that query?
or it is empty
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the ResultSet JavaDocs. You should see the method available to you. Alternatively you could change your sql to count the number of users that match your search criteria and check that.
 
Amritpal Singh Moomie
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the help
I figured out how to do it




 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic