Execute Update Return Generated Keys

Posted By admin On 13.12.20

The only way that some JDBC drivers to return Statement.RETURNGENERATEDKEYS is to do something of the following: long key = -1L; Statement statement = connection.createStatement; statement. Stack Overflow. Oct 06, 2009  How to return a primary key from a stored procedure that performs an insert. How to return a primary key from a stored procedure that performs an insert. Sep 25, 2009 03:27 PM. Could it have something to do with the fact that I'm using a scalar-valued function to generate the primary key and not Identity Increment? Thanks again!

Jan 18, 2019 Generated keys not requested. You need to specify Statement.RETURNGENERATEDKEYS to Statement.executeUpdate, Statement.executeLargeUpdate or Connection.prepareStatement. Operations Management. ERP PLM Business Process Management EHS Management Supply Chain Management eCommerce Quality Management CMMS.

Generated-->

Runs the given SQL statement, which can be an INSERT, UPDATE, or DELETE statement; or an SQL statement that returns nothing, such as an SQL DDL statement. Beginning in MicrosoftSQL Server JDBC Driver 3.0, executeUpdate will return the correct number of rows updated in a MERGE operation.

Overload List

NameDescription
executeUpdate (java.lang.String)Runs the given SQL statement, which can be an INSERT, UPDATE, DELETE, or MERGE statement; or an SQL statement that returns nothing, such as an SQL DDL statement.
executeUpdate (java.lang.String, int)Runs the given SQL statement and signals the Microsoft JDBC Driver for SQL Server with the given flag about whether the auto-generated keys produced by this SQLServerStatement object should be made available for retrieval.
executeUpdate (java.lang.String, int[])Runs the given SQL statement and signals the JDBC driver that the auto-generated keys that are indicated in the given array should be made available for retrieval.
executeUpdate (java.lang.String, java.lang.String[])Runs the given SQL statement and signals the JDBC driver that the auto-generated keys that are indicated in the given array should be made available for retrieval.

See Also

SQLServerStatement Members
SQLServerStatement Class

Join GitHub today

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up New issue

Have a question about this project?Generate a secure key on first direct app. Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments

commented Jan 18, 2019

TX-LCN 5.0 使用 mybatis 和 mysql-connector-java 8.0.12 高版本导致无法分布式插入

commented Jan 18, 2019

解决办法:

  1. <insert useGeneratedKeys='true'></insert> 标签使用 useGeneratedKeys 属性。
  2. 将 @TxcTransaction 注解改成 @LcnTransaction。
closed this Feb 7, 2019

Execute Update Return Generated Keys 2016

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment