Looks like data source 1 has the row for entity 1 locked and thus data source 2 cannot access that row. There are two ways to get around this (that I can think of).
a) You could handle entity 1 and entity 2 in the same datasource.
b) Or you will have to change the code such that data source 1 stores entity 1 and completes its transaction first. Then use data source 2 to look up entity 1 and add it to entity 2.