Native many to many association with maping

0
I’m trying to map a JSON which represent a wishlist. The wishlist has info and inside it has a list of products. I have represented this into the domain model with two non persistent entities. WishList and WishListProduct and a relation from many to many. I know you cannot do a many to many relation in native because then you cannot retrieve the info from the related entity, but this is the only way I can map correctly the JSON info. Any other relation (1-to-many or many-to-1) doesn’t map the WishListProduct, so I get a WishList object with an empty WishListProducts. What is the correct way to do this?   JSON {   "data": [     {       "customer_id": 6,       "id": 5,       "is_public": false,       "items": [         {           "id": 21,           "product_id": 144         }       ],       "name": "My Wish List",       "token": "fe888a1b-275e-4736-ac76"     }   ],   "meta": {     "pagination": {       "count": 1,       "current_page": 1,       "per_page": 50,       "total": 0,       "total_pages": 0     }   } }   WishList entity: _id (Integer) Is_public (Boolean) Name (String) Token (String) Count (Integer)   WishListProduct entity: _id (Integer) Product_id (Integer)
asked
1 answers
1

The way I would do this is to create a JSON Structure and change the Object Names to be specific, like this:

Then create an import mapping with all of the elements of the JSON structure, like this:

And finally select Map Automatically in the Import mapping, resulting in this domain model:

Will this work for you?

answered