google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

Defer save with null id #225

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
class MyEntity {
  @Id Long autogeneratedId;
}
ofy().defer().save().entity(new MyEntity())

What is the expected output? What do you see instead?
java.lang.IllegalArgumentException: You cannot create a Key for an object with 
a null @Id. Object was simonton.gae.LogBasedCounter$LogCounterEntry@843316
    at com.googlecode.objectify.impl.KeyMetadata.getRawKey(KeyMetadata.java:185)
    at com.googlecode.objectify.impl.Keys.rawKeyOf(Keys.java:35)
    at com.googlecode.objectify.impl.Keys.keyOf(Keys.java:28)
    at com.googlecode.objectify.impl.ObjectifyImpl.deferSave(ObjectifyImpl.java:314)
    at com.googlecode.objectify.impl.DeferredSaverImpl.entity(DeferredSaverImpl.java:23)

What version of the product are you using? On what operating system?
5.1.1 on Windows 8.1

Please provide any additional information below.
I am not finding any documentation that deferred saves are not available for 
entities with an auto-generated id.  I think it should either be modified to be 
possible, or documented as forbidden.

Original issue reported on code.google.com by ersim...@gmail.com on 14 Nov 2014 at 10:41

GoogleCodeExporter commented 9 years ago

Original comment by lhori...@gmail.com on 18 Nov 2014 at 8:01

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 6b27f1a1e480.

Original comment by lhori...@gmail.com on 18 Nov 2014 at 5:44

GoogleCodeExporter commented 9 years ago
Good catch. This has been fixed in master and will make its way out in the next 
release of Objectify.

Original comment by lhori...@gmail.com on 18 Nov 2014 at 5:45

GoogleCodeExporter commented 9 years ago
Jeff this fix alone deserves a separate release.

Original comment by hus...@gmail.com on 27 Nov 2014 at 1:30

GoogleCodeExporter commented 9 years ago
There ya go, 5.1.2 is on way to maven central

Original comment by lhori...@gmail.com on 27 Nov 2014 at 7:07