Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Hibernate not returning existing data

  • 25-01-2012 05:13PM
    #1
    Closed Accounts Posts: 6,075 ✭✭✭


    I have a small java app that connects to a MS Sql Server database via Hibernate.

    I have a table called user that has 3 colums, Username, password and email.

    I have a model POJO called UserModel that has getters and setter for Username and password.

    Using hibernate, my code does a 'find' on the database, passing in Username and password and to returning a UserModel object.

    What I need:

    I want to remove the need to pass the password into the query, e.g.
    List<UserModel> UserModels = null;
        UserModel model = new UserModel();
        model.setName(Username);
        //model.setPassword(password); <-- want to remove the need for this
        UserModels = getUserModelManager().find(model);
    

    Even though I know the data is there, my query returns nothing, but when I pass in the password, I get the correct row..

    Can any one suggest why nothing is returning?

    Any suggestion welcome.


Comments

  • Closed Accounts Posts: 6,075 ✭✭✭IamtheWalrus


    I rebuilt and redeployed my code and it worked.. A row was returned by only passing in a username.


Advertisement