BatchUpdates + Forein Keys
I am trying to create a preparedstatement that uses a for loo to insert multiple records at once. The isert works with no problems, however when I try to save data to a supporting table i get Foreign key constaint errors. I am assuming that the problem is in that the insert has not yet finished, so teh Primary keys in the first table cause a FK error. Is there a way around this? I have autocommit set to true and if I set it to false, and place a commit after the executeUpdate it returns the same results.
My code is as follows:
PreparedStatement insertEvents = con.prepareStatement("INSERT INTO Event (event_id, event_uuid, summary) VALUES (?,?,?)";
for (Event event : eventList) {
insertEvent.setInt(1, event.getPrimaryKey());
insertEvent.setString(2, event.getUUID);
insertEvent.setString(3, event.getSummary);
}
insertEvents.executeUpdate();
// I then try to save to the supporting tables and the error is thrown on the first record.

