1. No, the parent will not be updated. You are updating a Child - not a parent. However - you will want to be very careful with Child entities in a Collection. I believe there is an outstanding issues where if you only update the Child entity, the Parent entity will not know the Collection has changed and will not be persisted: http://groups.google.com/group/google-appengine-java/browse_thread/thread/152cdafdded18611/f91dc4c6a477b8d8?show_docid=f91dc4c6a477b8d8
<http://groups.google.com/group/google-appengine-java/browse_thread/thread/152cdafdded18611/f91dc4c6a477b8d8?show_docid=f91dc4c6a477b8d8>2. No, this will throw an IllegalArgumentException: java.lang. IllegalArgumentException: OPT_VERSION: java.sql.Timestamp is not a supported property type. If you need this functionality, please open an issue in our issue tracker: http://code.google.com/p/googleappengine/issues/list For the purposes of optimistic locking, I'm not sure I see the benefit of using this anyway - as a developer, you do not care what lock mechanism is being implemented. If you require an "updated" timestamp, you should use the preUpdate hook instead, since using a DATE_TIME version will cause every one of your updates to pay the cost of an additional transactional get before you save. 3. I'm not familiar with the behavior here. Can you describe what the expected behavior should be? If you can write a test case that either demonstrates this or contradicts what is expected it would be extremely helpful. On Tue, Jan 19, 2010 at 12:08 AM, Brandon <[email protected]> wrote: > Hi, > > Consider an example where class A has a "child" property of class B, > and B has a property "title", as follows: > > @PersistenceCapable > @Version(... field-name="version") > Class A { > protected long version; > > @Persistent > protected B child; > > .... > } > > @PersistenceCapable > Class B { > @Persistent > protected String title; > > public void setTitle(String title) {...} > > .... > } > > tx.begin(); > // get an instance of Class A > A parent = ...; > parent.child.setTitle("foo"); > pm.makePersistent(parent); > tx.commit(); > > > Question1: Will the version of "parent" be increased in this case > (when all its property values are not changed directly)? > > Question2: Does appengine support the VersionStrategy.DATE_TIME > attribute in @Version? > > Question3: Given that A is annotated with @Version and the version > field is protected, should a subclass of A needs to be annotated with > @Version too in order to have the version managed by JDO/JPA? > > Sorry in advance if these questions appear somewhere else. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > > -- Ikai Lan Developer Programs Engineer, Google App Engine http://googleappengine.blogspot.com | http://twitter.com/app_engine -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" 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-java?hl=en.
