Siva Reddy Vippala
Siva Reddy Vippala

Reputation: 211

objectify - java.lang.IllegalStateException: At path ** Expected property value

I have a below entity containing an EmbedMap, which in turn contains an Embed object.

@Entity
public class Data
{
    @Id private long id;
    private String name;
    @EmbedMap Map<String, PlayerData> dataMap = Maps.newHashMap();
}

@Embed
public class PlayerData
{
    private long playerId;
    List<TurnData> turns = Lists.newArrayList();
}

@Embed
public class TurnData
{
    private long turnId;
    private long score;
}

When I try to save the Data entity into datastore using Objectify, I get the below exception (I am currently on objectify 4.0b3):

com.googlecode.objectify.impl.cmd.SaverImpl.entity(SaverImpl.java:33) at test.BattleResponseTest.populateBattlesData(BattleResponseTest.java:172) at test.BattleResponseTest.testGetAllBattles_checkBattleIds(BattleResponseTest.java:185) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) 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.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) 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.IllegalStateException: At path 'dataMap.1.turns': Expected property value, got {turnId={1}, score={135000}} at com.googlecode.objectify.impl.Path.throwIllegalState(Path.java:134) at com.googlecode.objectify.impl.Transmog.populateFields(Transmog.java:402) at com.googlecode.objectify.impl.Transmog.populateFields(Transmog.java:430) at com.googlecode.objectify.impl.Transmog.populateFields(Transmog.java:430) at com.googlecode.objectify.impl.Transmog.populateFields(Transmog.java:430) at com.googlecode.objectify.impl.Transmog.save(Transmog.java:364) at com.googlecode.objectify.impl.Transmog.save(Transmog.java:100) ... 30 more

Kindly help?

Upvotes: 0

Views: 190

Answers (1)

stickfigure
stickfigure

Reputation: 13556

The format Objectify v4 uses to store embedded collections does not accommodate storing collections nested inside of collections. If you migrate to v5, you will be able to do this.

Upvotes: 2

Related Questions