I am quite new to database and I am in the following situation.
I have two tables defining a 1:n relation, let's say Company and Employee which I access in two separated database connections in postgres.
I am now writing a new company and some of its employees to the respective tables, in two separate transactions. I then commit the company transaction and then the employee transaction. But what should I do if the employee transaction failed, AFAIK I can't unroll the committed company transaction?
I have the feeling that my approach of handling dependent transaction in separate Database-Connections is not from the book.