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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.