I don't understand how to get auto generated keys with commons-dbutils?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
You can use
QueryRunner#insert()
. Below is an example. Given a table calledusers
, which has an auto generated primary key column and avarchar
column calledusername
, you can do something like this:As a matter of fact I think it cannot be done with the current version of common-dbutils. A few months ago, when I was working for another company, I extented the QueryRunner with my own implementation.
The request has been submitted to the DbUtils project, and there you can even find a viable implementation which I guess you could copy if you really need it.
https://issues.apache.org/jira/browse/DBUTILS-54