I have two MySQL tables, Persons and Addresses. In Persons table there is column id_address which is foreign key for Addresses column with same name. Column id_address in Addresses has AUTO_INCREMENTed value. So when I want to insert new person, I insert address which sets LAST_INSERT_ID() to new value, then this last id I use for Persons.id_address.
So my question is, is there any option to set batch insert for these two tables, and then insert more rows in one step?
I'm using Java with MySQL driver and I need this without ORM framework.
EDIT: I found it's not possible, related answer is here: Two different prepared statements in one single batch