[SalesForce] Bulk API and load into Multiple Objects from single CSV file

I'm extremely new to salesforce and Bulk API. I've search for a possible solution for a couple of days, but haven't had any luck.

I'm using the java examples for the bulk api load that I found here, here and here but I can't find the solution I'm looking for or I have missed something.

I have a CSV file with roughly 63 columns and roughly 1 million records. My goal is to upload this single CSV file to multiple sobjects. I'm currently able to upload to a single sobject with a CSV file that has the exact names as the sobject. I have found this link but I'm unable to find information on how to actually use this spec.csv file. Building it shouldn't be a problem. I need to break up this CSV file with 1 million records into multiple sobjects. A few columns need to go into Account and Contact and a few need to go into my custom objects as well. All in all, there are 6 sobjects this CSV file will populate. Can someone please direct me how this is possible?

Thank you in advance.

Best Answer

In response to the comment thread...

Here simple example of using a trigger to transfers from the bulk API uploaded Upload__c records to Account and Contact records:

// Fields of Upload are the CSV fields
trigger OnUploadInsert on Upload__c (after insert) {
    Account[] accounts = new Account[] {};
    Contact[] contacts = new Contact[] {};
    for (Upload__c u : Trigger.new) {
        accounts.add(new Account(
                Name = u.CompanyName__c
                ));
        contacts.add(new Contact(
                FirstName = u.First__c,
                LastName = u.Last__c,
                Birthdate = u.DateOfBirth__c
                ));
    }
    insert accounts;
    for (Integer i = 0; i < accounts.size(); i++) {
        contacts[i].AccountId = accounts[i].Id;
    }
    insert contacts;
}

In a real world example relationships are not necessarily 1 to 1 and things get more complicated when you want to hook up to existing data too.