For some data mappings, the runtime will fail with the following message:
Failed to cast instance of type <Entity1> to the required type <Entity2>
This can happen when the mapping is trying to map a single source instance to two different target instances with the following conditions:
- The two target entities share a common base entity
- The mapping is configured to match source to target instances by using the instance identifier
The workaround is to change the matching strategy to match by condition or property instead of matching by identifier.
This happens because in the runtime, instances that share a common base entity are not allowed to have the same id. Meanwhile in the mapping, when using matching based on identifier, the runtime will always give target instances the same id as their related source instances. This is required in order to be able to update these created instances in a subsequent mapping.
Overview
Content Tools