There is still at least one problem - the
getLastRowResultSet method. Rows in most (for all practical purposes "all") relational databases do not have any intrinsic order. In simple cases it might appear that
SELECT * returns rows in the order in which they were created, but in real life conditions that is almost never true (see our
FAQ page regarding the database ordering). Another problem is that
ResultSet.last() is expensive operation, it fetches all rows from the query, which gets worse as the table grows. Again, this is easy to miss when testing with a low volume of data.
You need to find another way of locating the row which was just inserted. I don't know PostgreSQL, so I cannot really advice what works best there. One of possible approaches should be to generate the primary key value in a separate call (usually using a sequence) and use it then to insert the new row, which can then be obtained by its primary key. By the way, it looks like your table doesn't have a primary key, so you should perhaps add one.