I defined a Google Cloud Endpoints that uses Objectify to deal with the datastore. The issue is that my model uses the objectify com.googlecode.objectify.Key class.
@Entity
public class RealEstateProperty implements Serializable {
@Id
private Long id;
@Parent
private Key<Owner> owner;
private String name;
private Key<Address> address;
}
In my endpoint I defined a method to create a RealEstateProperty:
@ApiMethod(name = "create", path = "properties", httpMethod = HttpMethod.POST)
public void create(RealEstateProperty property, User user) throws Exception {
}
In the API Explorer, the create method expects a string representing a Key for the address. The issue is that I'd like to provide the address and not the Key.
Is it possible to create an endpoint with objectify? If so, how do you design your data model to deal with Key?