Jasypt Users Forum

jasypt + Hibernate: Restrictions.eq

View: New views
1 Messages — Rating Filter:   Alert me  

jasypt + Hibernate: Restrictions.eq

by Hendrik Hilleckes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

+------------------------+
  Jasypt Users List      
  http://www.jasypt.org 
+------------------------+

MessageHi guys,

i have a problem using jasypt together with Hibernate. I basically just followed the tutorial here:
https://www.hibernate.org/415.html

The encryption seems to work very well. I can see, that the data in the .data file is encrypted.

I have a table called "account" and at startup the application lists every account.
That works fine! It displays the real text, not the encrypted from the file. So i assume, that
writing (encrypting) and reading (decrypting) works fine.

The next step is a login.
The user chooses an account and enters the password.

Then i try to find the account like this:

    public Account find(String username, String password) throws HibernateException {
        Session session = HibernateUtil.getSession();
        try {
            Criteria criteria = session.createCriteria(Account.class).add(
                    Restrictions.eq("User", username)).add(
                    Restrictions.eq("Pass", password));
            return (Account) criteria.uniqueResult();
        } catch (HibernateException exception) {
            log.error(exception);
            throw exception;
        }
    }

But he won't find the account. I searched through the net a lot, but i could only find a statement,
that Restrictions.like doesn't work, but .eq does. Well, for me, it doesn't.

What do i do wrong?

Thanks in advance, hhllcks

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
jasypt-users mailing list
jasypt-users@...
https://lists.sourceforge.net/lists/listinfo/jasypt-users