9

I'm using GAE 1.8.1 and I've hit an issue with Objectify with the new scattered ID system. At least I think it's Objectify, I'm not sure (Using Objectify 4 RC1). I'm getting this..

Caused by: java.lang.IllegalArgumentException: id cannot be zero
    at com.google.appengine.api.datastore.KeyFactory.createKey(KeyFactory.java:52)
    at com.google.appengine.api.datastore.KeyFactory.createKey(KeyFactory.java:47)
    at com.googlecode.objectify.Key.<init>(Key.java:91)
    at com.googlecode.objectify.Key.create(Key.java:39)
    at com.googlecode.objectify.impl.cmd.LoadTypeImpl.id(LoadTypeImpl.java:77)

The records get put in the datastore correctly as they have an ID, but this is on fetching the data out.

So I have to roll back to what it was before for the time being. It states here that you can specify the legacy ID generation with modifying the auto_id_policy in appengine-web.xml. I've tried adding this to the file:

<auto-id-policy>legacy</auto-id-policy>

But it doesn't work, or at least it might work if the XSD it validates against supports this tag. You can't deploy the app because of this.

Eurig Jones
  • 8,226
  • 7
  • 52
  • 74
  • Hi there, I encountered the same issue as you did on a project that was kept untouched for several months. You just need to update your App Engine SDK from 1.8.1 to a newer version. I can confirm that on my project, which has 1.8.1.1 for its App Engine SDK, your XML validates successfully. – Ibrahim Arief Sep 08 '13 at 11:39

2 Answers2

1

we are aware of this issue and working on a fix.

Rohwer
  • 149
  • 1
  • A fix for the exception or a fix for the missing XSD tag? – Eurig Jones Jun 13 '13 at 21:28
  • 1
    any news on this? GoogleAppEngine Launcher is stating error: argument --auto_id_policy: invalid choice: 'legacy' (choose from 'sequential', 'scattered') on calling it with --auto_id_policy=legacy – skurt Jun 13 '13 at 21:46
  • Future reference for people that stumbled upon this issue: Update your App Engine SDK version from 1.8.1, this issue has been fixed as of 1.8.1.1 onwards. – Ibrahim Arief Sep 08 '13 at 11:37
0

The problem appears to be you are passing in 0 to load().id(). I don't think this has anything to do with scattered ids or Objectify.

stickfigure
  • 13,458
  • 5
  • 34
  • 50
  • I would have thought so as well. But since moving to 1.8.1 it does this. Previous versions work fine. If I was passing in a 0 as a bug in my code then it would certainly fail for every version. Would you agree? – Eurig Jones Jun 16 '13 at 08:38
  • Without seeing your code that calls load().id(), it's really hard to tell. – stickfigure Jun 16 '13 at 16:00