I just wonder if you need an unique ID only, then you can let Google do it for you (sorry if this interrupted your discussion) http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/DatastoreService.html#allocateIds%28com.google.appengine.api.datastore.Key,%20java.lang.String,%20long%29
On Thu, May 20, 2010 at 11:45 AM, Luca <luca.mas...@gmail.com> wrote: > Some more infos. > > The behavious of DataNucleus depends on the strategy I choose to > generate the @Id field. > > When I use GAE I always use the GenerationType.IDENTITY because I read > that on JDO docs (http://code.google.com/appengine/docs/java/datastore/ > dataclasses.html<http://code.google.com/appengine/docs/java/datastore/%0Adataclasses.html>: > Primary keys of type Key require a @PrimaryKey > annotation and a @Persistent(valueStrategy = > IdGeneratorStrategy.IDENTITY) annotation) and I saw that GAE > documentation about JDO is usually more deep that JPA documentation. > > But If I choose GenerationType.AUTO then I see that also DataNucleus, > like all the other persistence provider, generate the key after the > persist and before the flush/commit. Very strange indeed because for > H2 DataBase the AUTO should choose IDENTITY generation. > > I'm still more convinced this is a bug in DataNucleus that affect the > way we work on Google App Engine. > > On 19 Mag, 07:26, datanucleus <andy_jeffer...@yahoo.com> wrote: > > I've already asked you twice to post your class. You haven't. That > > provides no context for any comment, and I've already told you why > > datastore operations are delayed until commit/flush. Why do you think > > there's a flush() method if you think things ought to go straight to > > the datastore ? > > > > JPA2 spec page 29 footnote 12. > > <spec>[12] If the application does not set the primary key attribute > > corresponding to the relationship, the value of that attribute may not > > be available until after the entity has been flushed to the database.</ > > spec> > > > > <spec>/** > > * Synchronize the persistence context to the underlying database. > > * @throws PersistenceException if the flush fails > > */ > > public void flush();</spec> > > > > <spec>• If X is a new entity, it becomes managed. The entity X will be > > entered into the database at or > > before transaction commit or as a result of the flush operation.</ > > spec> > > > > http://www.datanucleus.org/products/accessplatform/jpa/transaction_ty... > > > > End. > > > > -- > > 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 > google-appengine-j...@googlegroups.com. > > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> > . > > For more options, visit this group athttp:// > groups.google.com/group/google-appengine-java?hl=en. > > -- > 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 > google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.