second instance of the setFilter() method is the problem.
rephrase it to setFilter("userLogin == vLogin && password == vPassword")
seems like each time you call setFilter() it clears the previously set
filters

On Sat, Feb 27, 2010 at 5:34 PM, Andriy Andrunevchyn <[email protected]>wrote:

> The first I store UserModel to DB
> Then I try getting user and my method(see below) return null but I
> check db and there is stored object
> I don't know what a problem
> Help!
> My method
> public UserModel getUserByLoginAndPassword(String login, String
> password) {
>                PersistenceManager pm = getPersistenceManager();
>                Query getUserQuery = pm.newQuery(UserModel.class);
>                getUserQuery.setFilter("userLogin == vLogin");
>                getUserQuery.setFilter("password == vPassword");
>                getUserQuery.declareParameters("String vLogin, String
> vPassword");
>
>                UserModel result = null;
>                try {
>                        List<UserModel> list = (List<UserModel>)
> getUserQuery.execute(
>                                        login, password);
>                        if (!list.isEmpty()) {
>                                result = list.get(0);
>                        }
>                } finally {
>                        getUserQuery.closeAll();
>                        releasePersistenceManager(pm);
>                }
>                return result;
>        }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to