I don't know what JDO will do, but I can tell you that this won't help
you reduce data storage requirements, if that is your goal.

Some things to know about the Low-Level API, and thus any layer on top
(JDO, JPA, Objectify, Twig, whatever):

 * Numeric keys will be persisted as a Long (or String).

 * All numeric property values get persisted as a Long (even if they
get converted back to something smaller by the library).

Jeff

On Sat, Jan 16, 2010 at 5:59 AM, Bert Peters <[email protected]> wrote:
> Thank you for that information, but that's not what i meant.
> What i did mean is whether this is correct/possible:
>
> @PrimaryKey
> @Persistent(idGeneratorStrategy=INCREMENT)
> private Integer id;
>
> On Jan 16, 2:25 pm, jd <[email protected]> wrote:
>> 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 <[email protected]> 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 [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.
>
>
>
>
-- 
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.


Reply via email to