honzajde
honzajde

Reputation: 2398

Create key with objectify

Calling Objectify method: Key.create(ParentClass.class parentClass, KindClass.class kindClass, String id)

for the exactly same parameters twice at the same time, I got: name=UWxoCs7KpxDu2fYBI3s2fkOq-wM name=jOqQzhZzAScJ0O3OEtYF3jzb34Q

Does this method need to run in a transaction so I get a predictable result?

Upvotes: 0

Views: 672

Answers (2)

stickfigure
stickfigure

Reputation: 13556

The app id and namespace are also encoded in the key. You can see the components that represent a stable key here:

https://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/appengine/api/datastore/Key.java

Upvotes: 1

elcid
elcid

Reputation: 574

I cannot find any reference to an Objectify Key.createKey method. Which version of Objectify are you using?

There is however a Key.create(Key<?> parent, java.lang.Class<? extends T> kindClass, java.lang.String name), trying using that and let us know how you get on.

Here is the API page for Key https://objectify-appengine.googlecode.com/svn/trunk/javadoc/com/googlecode/objectify/Key.html

Upvotes: 0

Related Questions