这是我尝试持久化实体时的错误:
com.googlecode.objectify.SaveException: Error saving com.mycomp.simplify.KeyValueVersion@60991f: You cannot create a Key for an object with a null @Id. Object was com.mycomp.simplify.Key@1bf3d87
at com.googlecode.objectify.impl.Transmog.save(Transmog.java:102)
at com.googlecode.objectify.impl.Concret
> Blockquote
eEntityMetadata.save(ConcreteEntityMetadata.java:150)
at com.googlecode.objectify.impl.engine.WriteEngine.save(WriteEngine.java:68)
at com.googlecode.objectify.impl.cmd.SaverImpl.entities(SaverImpl.java:56)
at com.googlecode.objectify.impl.cmd.SaverImpl.entity(SaverImpl.java:33)
at com.mycomp.simplify.core.ObjectifyGenericDao.put(ObjectifyGenericDao.java:52)
at com.mycomp.simplify.SimplifyImpl.access$0(SimplifyImpl.java:1)
at com.mycomp.simplify.SimplifyImpl$1.run(SimplifyImpl.java:43)
at com.mycomp.simplify.SimplifyImpl$1.run(SimplifyImpl.java:1)
at com.googlecode.objectify.impl.cmd.ObjectifyImpl.transactOnce(ObjectifyImpl.java:255)
at com.googlecode.objectify.impl.cmd.ObjectifyImpl.transactNew(ObjectifyImpl.java:232)
at com.googlecode.objectify.impl.cmd.ObjectifyImpl.transactNew(ObjectifyImpl.java:222)
at com.googlecode.objectify.impl.cmd.ObjectifyImpl.transact(ObjectifyImpl.java:214)
at com.googlecode.objectify.util.cmd.ObjectifyWrapper.transact(ObjectifyWrapper.java:165)
at com.mycomp.simplify.SimplifyImpl.put(SimplifyImpl.java:37)
at com.mycomp.simplify.ResourceTest.testCreateFetch(ResourceTest.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.IllegalArgumentException: You cannot create a Key for an object with a null @Id. Object was com.mycomp.simplify.Key@1bf3d87
at com.googlecode.objectify.impl.translate.EntityClassTranslator.getRawKey(EntityClassTranslator.java:160)
at com.googlecode.objectify.ObjectifyFactory.getRawKey(ObjectifyFactory.java:270)
at com.googlecode.objectify.impl.translate.EntityReferenceTranslatorFactory$1.saveValue(EntityReferenceTranslatorFactory.java:39)
at com.googlecode.objectify.impl.translate.EntityReferenceTranslatorFactory$1.saveValue(EntityReferenceTranslatorFactory.java:1)
at com.googlecode.objectify.impl.translate.ValueTranslator.savePropertyValue(ValueTranslator.java:51)
at com.googlecode.objectify.impl.translate.PropertyValueNodeTranslator.saveAbstract(PropertyValueNodeTranslator.java:38)
at com.googlecode.objectify.impl.translate.AbstractTranslator.save(AbstractTranslator.java:38)
at com.googlecode.objectify.impl.TranslatableProperty.executeSave(TranslatableProperty.java:145)
at com.googlecode.objectify.impl.translate.ClassTranslator.saveMap(ClassTranslator.java:94)
at com.googlecode.objectify.impl.translate.MapNodeTranslator.saveAbstract(MapNodeTranslator.java:38)
at com.googlecode.objectify.impl.translate.AbstractTranslator.save(AbstractTranslator.java:38)
at com.googlecode.objectify.impl.Transmog.saveToNode(Transmog.java:109)
at com.googlecode.objectify.impl.Transmog.save(Transmog.java:96)
... 39 more