PreparedStatement getGeneratedKeys () JDBC

I used getGeneratedKeys after pasting into Batchmode. I assume that the order I with the keys returns is the same as the inserts in my grouped inserts. I want to use the keys as foreign keys in another table and you need to map the data to the foreign key.

  • It is right? The API says nothing about order ...: - (
  • What happens if I do an "insert ignore", do I need to calculate the offset from the executeBatch () function - Function? Or is there an easier way to match the generated keys and inserted data in my java application?

Thanks a lot of guys. I am happy for any hint.

+3
source share

Source: https://habr.com/ru/post/1795282/


All Articles