Skip to content
Advertisement

MyBatis oracle insert new row always return wrong primary id value

Try to get the primary id after inserting a new row to oracle DB

JavaScript

Here is the java call

JavaScript

New data/row can be inserted into DB with no issue with correct primary key/id. But myID is always returned as 1(supposed to be 8971). How can I get the correct value. Thanks in advcance.

version:

JavaScript

Advertisement

Answer

Your insert returns 1 on success and 0 on failure. If you want to use the primary key, use getId() of the object you used to insert.

*example)

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement