|
Question:
How can I get PrimaryKey without select after insert?I try to get Primary Key value after insert through JDBC. I don't want to execute additional select statement.
Put primary key column in insert columns, it must be of type SERIAL.
Put zero in insert values for PrimaryKey(PK) column. Put constant on prepare statement method of JDBC connection Get result from prepared statement after insert with getGeneratedKeys() It returns a result set, get generated key from result set and close it. Example :
Vote:
Please vote! Your opinion matters!
If you haven't found what you've looking for, post a question
|
|