Fixing Olingo Error “Format of ‘1’ is not compatible with ‘Edm.String’.”

When changing types in Olingo OData services, you may get an error like the following:

Format of '1' is not compatible with 'Edm.String'.

This indicates you have a line like this:

return type.valueOfString(key.getLiteral(), 
  EdmLiteralKind.DEFAULT, 
  property.getFacets(), 
  Integer.class);

Which should in fact be like this:

return type.valueOfString(
  key.getLiteral(), 
  EdmLiteralKind.DEFAULT, 
  property.getFacets(), 
  String.class);

Leave a Reply

Your email address will not be published. Required fields are marked *