Creating records with complex joins

Creating records with complex joins

  

I have defined a data model with a table called Entity that has multiple tables joined on EntityId. So, for example, I have a table called Person and other tables called Addresses, Email, and Phone all of which reference the same Entity Id. In an aggregate I define joins on EntityId for all of these records. Is there a way that all of these will be automatically created based on the aggregate structure or do I have to first create an entity record, and then all the others?

Hello Steve,

It's usual to first create the Entity record and only after, with the ID returned by the Entity Action Create (or CreateOrUpdate) you create any "associate" records on other entities.

If your associate entities are not "extension" entities (the Identifier is also a FK to the main entity, creating a 1:1 relationship), AND the FK for the main entity in the associated entities is not MANDATORY, than you have the possibility of create in any order, and update later, when you have the ID.

But I think its a bad way of doing things (in general, at least).

Cheers,
Eduardo Jauch

Eduardo Jauch wrote:

Hello Steve,

It's usual to first create the Entity record and only after, with the ID returned by the Entity Action Create (or CreateOrUpdate) you create any "associate" records on other entities.

If your associate entities are not "extension" entities (the Identifier is also a FK to the main entity, creating a 1:1 relationship), AND the FK for the main entity in the associated entities is not MANDATORY, than you have the possibility of create in any order, and update later, when you have the ID.

But I think its a bad way of doing things (in general, at least).

Cheers,
Eduardo Jauch

Thanks for your response, Eduardo. I thought that would probably be the case, but I was hoping there was a slick way of doing it automatically.


Right now, there isn't :)

Cheers,
Eduardo Jauch