Answer
The order is not important here, but reference to other entity object. You can just use the code
[locObj addWithRoomObject:roomObj]; roomObj.withLocation = locObj;
There is no such custom supported class. You can just use auto generated accessors in core data and it will automatically handle. You can call the function:
[locObj addWithRoomObject:roomObj];
UPDATE
To add more rooms:
Location *locObj = [NSEntityDescription insertNewObjectForEntityForName:@"Location"
inManagedObjectContext [self managedObjectContext]];
locObj.locationName = LOCATION_NAME;
Room *room1 = [NSEntityDescription insertNewObjectForEntityForName:@"Room"
inManagedObjectContext:[self managedObjectContext]];
// Fill room1 details
...
room1.withLocation = locObj;
[locObj addWithRoomObject:room1];
Room *room2 = [NSEntityDescription insertNewObjectForEntityForName:@"Room"
inManagedObjectContext:[self managedObjectContext]];
// Fill room2 details
...
room2.withLocation = locObj;
[locObj addWithRoomObject:room2];
// so on..