If sequential ids is important I'd recommend allocating a suitably large
batch up front and then managing the assignment yourself.  You can get a
batch of sequential ids using the standalone JDO sequences to which Andy is
referring or the low-level datastore api.  Since your domain is
Accounting/HR I'm guessing 1 million ids should be plenty.  You can then
store nextId in the datastore.  As long as your fetch and your update of
this value are in the same transaction it should work fine, and since I
doubt you'll be dealing with a high rate of employee creation you shouldn't
run into much entity group contention, if any.

On Wed, Feb 10, 2010 at 5:15 AM, aswath satrasala <
aswath.satras...@gmail.com> wrote:

> Hello Max,
> thanks.
> I think sequential ids will be a must in my case. It does not have to be
> for a PK, but for non-pk is also fine.
> I am creating a small multi-tenancy Accounting/HR application and when I
> create employees, I am thinking of giving an employeeID for the employee.
> In addition, I want to be able to specify the start range of the employeeID
> also and add prefix for the start range
>
> Looking into the following for a non-pk field.
>     @Persistent(valueStrategy = IdGeneratorStrategy.SEQUENCE)
>
> Hopefully this will work for me.
>
> Thanks
> -Aswath
>
>
>
>
> On Wed, Feb 10, 2010 at 10:42 AM, Max Ross (Google) <
> maxr+appeng...@google.com <maxr%2bappeng...@google.com>> wrote:
>
>> Hi Aswath,
>>
>> Unfortunately there is no way to guarantee the assignment of sequential
>> ids using JDO on App Engine, or even using the low-level datastore api.
>> This is because ids are allocated in batches across many datastore backends,
>> and one request to get the next id may hit one backend while another may hit
>> a different backend.  Is sequential ids a hard requirement?
>>
>> Max
>>
>> On Tue, Feb 9, 2010 at 8:27 PM, aswath satrasala <
>> aswath.satras...@gmail.com> wrote:
>>
>>> Hello Max,
>>> I am planning to use IdGeneratorStrategy.INCREMENT feature to assign
>>> sequential ids for entities I am creating.  for example, Employee.
>>>
>>> -Aswath
>>>
>>> On Wed, Feb 10, 2010 at 5:49 AM, Max Ross (Google) <
>>> maxr+appeng...@google.com <maxr%2bappeng...@google.com>> wrote:
>>>
>>>> JDO Sequences work, we just haven't publicized them.  The DataNucleus
>>>> docs should tell you everything you need to know:
>>>> http://www.datanucleus.org/products/accessplatform/jdo/sequences.html
>>>>
>>>> IdGeneratorStrategy.INCREMENT is not yet implemented.  What are you
>>>> looking to use it for?
>>>>
>>>> Max
>>>>
>>>>
>>>> On Mon, Feb 8, 2010 at 3:20 AM, Vincent TELLIER <
>>>> tellier.vinc...@gmail.com> wrote:
>>>>
>>>>> I tried the incrementation, but I got an error saying that it was not
>>>>> implemented in the appengine datastore.
>>>>>
>>>>>
>>>>> TELLIER Vincent
>>>>> + Email : cont...@tellier-vincent.eu
>>>>> + Contact messenger (msn) : abs...@esugenus.fr
>>>>>
>>>>>
>>>>> 2010/2/8 aswath satrasala <aswath.satras...@gmail.com>
>>>>>
>>>>> See if the following annotation help you.
>>>>>> @Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT)
>>>>>>
>>>>>> -Aswath
>>>>>>
>>>>>>
>>>>>> On Mon, Feb 8, 2010 at 1:18 AM, datanucleus <andy_jeffer...@yahoo.com
>>>>>> > wrote:
>>>>>>
>>>>>>> What getNextID feature on JDO ? i.e please make reference to the JDO
>>>>>>> API and which particular API Method you're referring to
>>>>>>>
>>>>>>> --
>>>>>>> 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<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<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<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<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<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<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.

Reply via email to