Keys can either have a system generated long "id" (not set by you) or
a String "name".

There used to be no way to create an Entity with a long - but now (as
of 1.2.7?) there is a constructor Entity(Key) and you can create a key
with a long.  But the docs say:

"Creating an entity for the purpose of insertion (as opposed to
update) with a key that has its id field set is strongly discouraged
unless the key was returned by a KeyRange."

So basically the answer is still no.

Twig gets around this by converting whatever field you declare as a
@Key into a String and back again - even Integers.

On Jan 16, 7:02 pm, Bert Peters <bert.ljpet...@gmail.com> wrote:
> I was just wondering whether I could use an Integer for a primary key
> in JDO, as it would be a great convenience in my application.
> I couldn't really find an answer to this in the documentation, so I
> ask you. Can I?
-- 
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.


Reply via email to