I'm using org.ofbiz.core.entity.jdbc.SQLProcessor in JIRA 6.1 while working with some non-JIRA tables in database.
I want to insert some row into some table.
After executing
sqlProcessor.executeUpdate("INSERT INTO some_table (name) VALUES ('itemName')")
I've to get ID of the inserted row. In MySQL there's a function last_insert_id for that purpose.
How to get this ID using SQLProcessor?
For MySQL used MySQL function LAST_INSERT_ID();
After executing INSERT called this function in the second query.
For PostgreSQL called nextval() before INSERT, then, after getting ID, executed INSERT with all fields filled.
Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.
Learn moreOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.