We have an entity with a field defined as a Map<Integer, String>. When we perform a fetch on the datasource, it returns the field as Map<String, String>. Is there a way to retain the Map<Integer, String> type on the fetched data? the datasource ds.xml currently defines the fields type as "any".
Announcement
Collapse
No announcement yet.
X
-
Hi there rle25,
In the underlying JavaScript, the equivalent of a Map only allows String keys, so that's what you get with the default translation which occurs with type:"any".
The right way to represent this type is as a DataSource type, where in the DataSource used as the type for the field, you declare the Integer (key) and String (value) as two separate fields, and reformat the data accordingly: on the server, it would be a List of Maps, where each Map has two keys, representing the Integer and String values.
This may or may not be worth doing in your app, vs just leaving it untyped and sprinkling in some code to parse the Integer value as needed.
Comment