I've 2 simple classes : public class Student { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) com.google.appengine.api.datastore.Key key; @Persistent public String firstName; @Persistent public String lastName; } And
public class Teacher { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) com.google.appengine.api.datastore.Key key; @Persistent public String firstName; @Persistent public String lastName; @Persistent public com.google.appengine.api.datastore.Key student; } First, I create a Teacher with only the fields 'firstname' & 'lastname' filled. It works. Then, I update my teacher with this code : Transaction tx = pm.currentTransaction(); tx.begin(); Teacher a = pm.getObjectById(Teacher.class, KeyFactory.stringToKey( the_key)); if(a != null) { try { a.setFirstName("test"); a.setLastName("test"); a.student = KeyFactory.stringToKey( req.getParameter("student101- key")); tx.commit(); } } pm.close(); } } After this transaction, the fields "firstname" & "lastname" are correctly updated. However, the field "student" is still null. Do you know Why? Thank you very much -- 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.