Search code examples
javaoracle-databasehibernatehibernate-native-query

Query is always returning 0 rows


I am new to Hibernate and trying to implement simple native query but I am always getting 0 rows. If the same query I am directly running in db then I can see the records.

    Query query = (Query) entityManager.createNativeQuery("SELECT * FROM USER_PROFILE where ROLE_ID=:roleId "
                + "and USER_EMAIL =:userEmail and USER_PWD=:password");
        query.setParameter("roleId",rolId );
        query.setParameter("userEmail", username.toLowerCase());
        query.setParameter("password", encryptedPwd);

       userInfos = query.getResultList();

But always userInfos list is empty. Can someone suggest what is going wrong.


Solution

  • Thank you everyone for your suggestion. I did a mistake here and password was getting encrypted twice. :( Fixed now.