Have you setup a test app and just tried some of these things? Some notes: - I use Python, but I think Java behaves pretty similar. - They have some articles that are good reading too. I am not sure if there is a java equivalent for all of these or not, but they are quite useful. http://code.google.com/appengine/articles/datastore/overview.html
Answers: "Doubt 1": Yes. Existing data will not be automatically modified. If you can specify default values, you may want to further investigate how that will impact you. It will not modify the data, but perhaps when you access that property on an old model you'll get the default. Not sure how it works in Java. "Doubt 2": Not sure about Java. In Python you can freely switch between integer ids and string "key names," so you would get both back. "Doubt 3": If you query by sex you would only get users with the sex property defined. "Doubt 4": Look into the bulk loader. Then go star issue 776, http://code.google.com/p/googleappengine/issues/detail?id=776 Robert On Sat, Sep 4, 2010 at 13:47, nacho <[email protected]> wrote: > Hi, first at all i must say that i come from the relational database > world. I have a few doubts about how datastore works being schemaless. > > For example, let's say that i have a presistent class User that haves > only 3 propertys: id (int), username (String) and password (String). > > So, i deploy my application on appengine and create a user with > username = "ian" and password = "ian123". > > And then i make a query, searching all the users, and i get the user > "ian". > > Ok, until here i understand this perfect. > > DOUBT 1: What happens, if i make a change to the User class and, for > example, i add to the class the property sex (String). Then i deploy > my app again in the appengine. > > Now i create a new user with this values username = "mcculloch", > password = "mc123" and sex = "M" and persist the user. > > I think that if i make the query to get all the useri will get the 2 > users, and the property sex to the user "ian" will be null. Is that > correct? > > DOUBT 2: Now i realize that i don't want to store the sex of the user, > and also i think that i don't want the id property as an integer. Now > i want that the username will be the key of the class, so i remove the > id property and add the annotation to make the username property the > Primary Key of the entity. > > Then i deploy the app on appengine, create a new user with this > values: username = "eric", password = "eric123". > > What does happen now i query all the users, will i get the two users? > > DOUBT 3: Let's say that i realize that i really need the sex property > for the users, so i add again the sex property to the User class and > deploy again to the datastore. > > If i query for all the users? What datastore will return to me? All > the users? Only those that the sex is not null? > > DOUBT 4: Finally, what happens if i want to have 2 enviroments of my > app? I have to create 2 apps on appengine? If this is the way, let's > supose that in my production enviroment i have a lot of data and i > want to make a copy of that data to my testing app so i can make > testing with good data. Can i copy that data from one app to another? > How could i? > > -- > 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. > > -- 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.
