Hi, I am trying to get to grips with persisting objects to the google datastore, I have been following the Google tutorial.
So the following code uses the PersistnaceManager to save an Employee instance: Employee employee = new Employee("Alfred", "Smith", new Date()); PersistenceManager pm = PMF.get().getPersistenceManager(); try { pm.makePersistent(employee); } finally { pm.close(); } } The Employee instance has an Id property: @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; So when the pm.makePersistent(employee); is called the id is autogenerated. This I understand. But my question is how do I fetch it back from the datastore if I do not know what the id is? In the tutorials it shows how you fetch objects using known information: Key k = KeyFactory.createKey(Employee.class.getSimpleName(), "alfred.sm...@example.com"); Employee e = pm.getObjectById(Employee.class, k); But of course when you want to fetch a list of saved objects you will not know any of the key information??? Or am I misunderstanding how this works? In basic terms I want to save a list of Employee objects and then I want to get them back without having to know the information they contain... Thanks Luca --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---