Request for @Embedded Lens Card for GAE

Please consider the following example.

@Entity public class Abc { @Id private Long id; @Unindexed private String name; @Embedded private Map<String, Xyz> objs; } public class Xyz { private String objName; private String objStatus; } 

Now I want an Abc object such that objs.get("someKey").getObjName().equals("someName") is true.

How to make this request in Objectify? Also, if I save "objs" as a list instead of a map, can I query the Abc object so that one of the list values ​​has objName as "someName"? Need help with this. Thanks

+4
source share
1 answer

You should be able to query like this:

 Objectify ofy = factory.begin ofy.query(Abc.class).filter("objs.someKey.objName=", "someName") 

Map keys are simply added to the object’s property map, using a dot as a separator and a map field name ("objs") as a prefix to avoid collisions.

+2
source

All Articles