How to properly use Circulair imports?

1
Quick question to all,   I have a domain model that has a document entity and an occurrence entity, each document can have multiple occurrences and vice versa.. I cant seem to properly construct seperate import mappings without having to manually address them for each level.    Thanks in advance!
asked
1 answers
0

Based on your description, it seems you are dealing with a many-to-many relationship between the document and occurrence entities. In Mendix, circular references in many-to-many relationships require some manual configuration. Here's how you can handle this scenario:

1. Create the entities: Ensure that you have the document and occurrence entities created in your domain model.

2. Add association sets: In the domain model, create two association sets: one in the document entity and one in the occurrence entity. Name them appropriately, such as "Occurrences" in the document entity and "Documents" in the occurrence entity.

3. Configure the association sets:
   - In the document entity, configure the "Occurrences" association set as a one-to-many association, allowing multiple occurrences per document.
   - In the occurrence entity, configure the "Documents" association set as a one-to-many association, allowing multiple documents per occurrence.

4. Create import mappings:
   - Create an import mapping for the document entity and include the necessary attributes.
   - Create a separate import mapping for the occurrence entity and include the necessary attributes.

5. Configure the import mappings:
   - In the import mapping for the document entity, map the "Occurrences" association set by referencing the import mapping of the occurrence entity. This establishes the link between documents and their corresponding occurrences during the import process.
   - In the import mapping for the occurrence entity, map the "Documents" association set by referencing the import mapping of the document entity. This establishes the link between occurrences and their associated documents.

6. Handle circular import manually: Since circular references require manual configuration, you need to specify the associations in the import mapping for each level explicitly. This means you'll need to address the circular relationship between document and occurrence entities manually in your import mapping configuration.

By following these steps, you can properly handle the many-to-many relationship between the document and occurrence entities in Mendix while performing import mappings. Although some manual configuration is necessary to address the circular import, this approach ensures the correct association between entities during the import process.

answered