0

what getGeneratedKeys() method do

Hi everyone I have 3 questions about statement.getGeneratedKeys() in code below? ResultSet resultSet =statement.getGeneratedKeys(); int generatedkey=0; if(resultSet.next()){ generatedkey=resultSet.getInt(1); } 1) can anyone explain me what getGeneratedKeys() method do ? 2) why do we use the next() and getInt(1) methods after it? 3) in getInt(1): why do we put 1 ? can't we put "id"?

6th Dec 2020, 10:12 AM
saeedeh
2 Respostas
+ 5
This resource will help you to know about getGeneratedkeys() method! ~ https://www.codota.com/code/java/methods/java.sql.Statement/getGeneratedKeys Might helps
6th Dec 2020, 10:55 AM
Piyush
Piyush - avatar
6th Dec 2020, 10:59 AM
saeedeh