Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Hibernate not returning existing data

Options
  • 25-01-2012 5: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