I have a scenario wherein I have two custom object records of the same type, ObjectX__c. I need to update object A (which exists) with a lookup to object B (which doesn't yet exist and is being inserted in this transaction). I want to avoid having to insert object b, then get the Id and then update object A.
In the past, I have used the approach outlined here to accomplish this, however since these two records are of the same sobject type, this will not work.
Does anyone have any suggestions or workarounds to this approach, the goal being to accomplish this in ideally one transaction with one dml?