Hi Guys,

I'm new in Google App Engine and I testing my first entities, I have
the follow problem:
After recover the follow object from the database, one of the fields:
country (that is a Key) is null !!! This is my entity:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class  User{

        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Long id;
        @Persistent
        private String emailAddress;
        @Persistent
        private String firstName;
        @Persistent
        private String lastName;
        @Persistent
        private Key country;

I check the table in the database just before recovering the object
(after create it) and the column country has the proper Key, I have no
idea why is not recovering it.

This is my method to recover it:

                User userLoaded = null;
                // Creating a PersistentManager to interact with the DataBase
                PersistenceManager pm = PMF.get().getPersistenceManager();
                // Query to check if the current user exists
                Query query = pm.newQuery(User.class);
                // Set the filter
                query.setFilter("emailAddress == emailAddressParam");
                // Declare the parameter
                query.declareParameters("String emailAddressParam");
                // Run the query and check the result
                try {
                        List<User> results = (List<User>) 
query.execute(emailAddressParam);
                        if (!results.isEmpty()) {
                                userLoaded = results.get(0);

             ------------------->>>>> HERE THE FIELD
userLoaded.getCountry() = NULL

                        } else {
                                throw new UnknownUserException();
                        }
                } finally {
                        pm.close();
                }

        }


--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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?hl=en.


Reply via email to