H, some issues surrounding this:

 * As you've probably figured out, the datastore natively only
supports two types of id, Long and String
 * Only Long will autogenerate
 * There is no guarantee that autogenerated values will be monotonic
or even valued in the low-order 4 bytes.

So, if you are using your id as an array index, you *must* assign keys
yourself rather than use autogeneration.

If you're doing this, the field value of the id can be Long but the
set/get methods can be int.

Jeff

On Sat, Dec 12, 2009 at 9:04 AM, Mark <[email protected]> wrote:
> You can use Long type as primary key.
>
> On Dec 12, 3:27 am, Hershiv Haria <[email protected]> wrote:
>> Hi all,
>>
>> I understand this is a relatively basic question, but I have been
>> searching around and can't find an answer that explains it. According
>> tohttp://www.datanucleus.org/products/accessplatform/jdo/types.html
>> there shouldn't be any problem with using an int as a PK, but when I
>> use it in my app it throws the following exception:
>>
>> Error in meta-data for my.syncdroidserver.Box.boxID: Unsupported
>> primary key type: int
>>
>> I'd like to know why I can't use ints and any ideas of what else to
>> use. I'd like to stick with simple types such as ints as the id is
>> going to be used as an index in arrays.
>>
>> Thanks,
>>
>> Hershiv
>
> --
>
> 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