How do you import generalized/specialized/inherited objects with many members?

Based on this XML Inheritance by Extension in the Mendix Platform it’s clear you can import specialized objects using an XML schema. It works nicely with a few specializations and where inherited members are limited to a few attributes.     Notice in the screenshot how inherited fields are included in EVERY specialized object. This is handy so you can select/deselect each member for any specialization.  BUT we have around 70 specializations and the parent/generalized entity has many attributes and associations we’d like to include. I bolded associations because they add much of the complication since some would be ‘Create new object’ while others are ‘Find by key’. Very tedious and plenty of room for human error. So as you might imagine the mapping can get pretty out-of-hand and would be a ton of work to set up and maintain.    Is there any other way to import specialized objects? And/or am I misunderstanding how this works and over-complicating, things?
2 answers

Hi Liam, 


Maybe you are over complexifing, but we cannot judge as we don't know what the “import” use case is. :-)

Is it about webservices being used? Is it about initial data loading?  Why the preference for XML? Note that the blog is from 2016...A lot has changed since then e.g. much more focus on REST / JSON API's….

Having in mind that I would solve it with REST/JSON api's  I did the following. 

  1. I created this domain model.
  2. Then I generated Message Definitions for Person, Employee and Customer.
  3. Then from the MessageDefinitions I created export/importmappings.

The results are inline with the expectations:

  • The mappings for Employee and Customer have the attributes and associations from the specialisation plus from the generalisation. 
  • The mappings for Person have the attributes and association from the generalisation only. 

So depending on the specialisation you are working with you have to use the correct mapping, but that is inevitable anyway. As you cannot first create the generic object and then specialize it…








The solution involved using a microflow to create a specialized version of the entity at the top level of the mapping. Then when the generalizations are mapped we used another microflow (for each generalization) to cast the appropriate specialized version.