How to retrieve previously auto-generated PK ID value using JDBC and HSQLDB

后端 未结 2 584
迷失自我
迷失自我 2021-01-12 14:43

I\'m working with JDBC and HSQLDB 2.2.9. What\'s the most efficient and accurate way to insert a new row into a DB and, subsequently, retain its id (PK set to a

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-12 14:52

    Not much action here, so I'll go ahead and answer to bring closure to this question. After playing around with the different options, and after see this question, I was able to get my option 3 to work. Like I mentioned in the edit to my question, I'm going to use option 3. Option 4 also worked fine, but since the accepted answer to the linked question is given by a reputable source, I am sticking with that. I wish I'd have seen that question/answer before starting this one, I'd have saved some time!

提交回复
热议问题