Skip to content

Add support for reflective lookups #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2015

Conversation

loganm
Copy link
Owner

@loganm loganm commented Jul 2, 2015

To achieve this, I kept a track of unresolved reflective lookups (where
the record and relatedTo SObjectTypes are the same, the the relatedTo
doesn't yet have an Id). If any of the records being inserted have a
reflective reference to anoth
er record being inserted in the same commit, then I perform an update
immediatel
y after the insert to "Backfill" the lookups with the Ids of the newly
inserted
records.

The tradeoff is clear and calculable. SObjects with unresolved
relationships incur 2xDML rows. I like this better than trying to order
the inserting of SObjects and incur and undetermined number of DML
statements.

To achieve this, I kept a track of unresolved reflective lookups (where
the record and relatedTo SObjectTypes are the same, the the relatedTo
doesn't yet have an Id). If any of the records being inserted have a
reflective reference to anoth
er record being inserted in the same commit, then I perform an update
immediatel
y after the insert to "Backfill" the lookups with the Ids of the newly
inserted
records.

The tradeoff is clear and calculable. SObjects with unresolved
relationships incur 2xDML rows. I like this better than trying to order
the inserting of SObjects and incur and undetermined number of DML
statements.
loganm added a commit that referenced this pull request Jul 2, 2015
@loganm loganm merged commit cd878ae into master Jul 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant