google app engine - Datastore Query returns null -
I am trying to get a sorted list of scores of players with a datastore after executing "user" type Unit of:
list & lt; Users & gt; Institutions = ofy (). Load (). Type (User.class) .order ("- score"). List (); By knowing that I have indexed the "score" attribute here "user.class"
@ id string user name; String password; @index int score; Organizations appear to be futile and I can not get the details of institutions. What am I missing?
I am still working on what I have succeeded on: Modify this method:
@ Override public user performance } {List & lt; Users & gt; List = ofy () Load (). Type (User.class) .order ("- score"). Range (5) .list (); User U = list.gate (list.size () - 1); Return (! U.getUserName (.) Equals (empty)); Return tap; } I'm getting rid of the "empty" value by checking the username field, but the return value was always the first user in the unit, no matter how much I changed the list. Get (index). I tried different values for the index, but always got the first user and could not retrieve others.
Public User RegisterAccount (String Confirms User Name, String Password, String)) {User User = OY} Load (). Type (User.class) .id (user name) .get (); If (user == tap) {if (password.contains ("")) empty return; If (password.compareTo (Confirm)! = 0) empty return; Other {user = new user (username, password, 0); . Ofy (save) () the unit (user) is now () .; Return user; }} And {return tap; }} There is a problem using this type (). Save () ... rather than datastore.put () ... I am thinking that it will affect it score is not found in the Scorsatore Index. One possible reason is that the index annotation property on "points" was not from the beginning, Added before the update, they can not be fetched by the command ("- score") command.
One more possible thing is trivial, but common! This is your class naming ("users") Do you have the right import? The general general class in GAE is com.google.appengine.api.users.User which is used for certification.
Comments
Post a Comment