commit on NullPointerException
От | Guthrie, John |
---|---|
Тема | commit on NullPointerException |
Дата | |
Msg-id | F779B05379CAD2118BD20090273017BF03E79C28@dc1.air.org обсуждение исходный текст |
Список | pgsql-jdbc |
I am using poolman to cache database connections, and I am seeing some odd behavior. Before I go digging into both postgres JDBC and poolman, I am hoping someone can point me down the right path (or even explain why it should do this). Anyway, what happens is that I get a connection from poolman and set autoCommit to false. I then do a few inserts, and whoops I have a bug that throws a NullPointerException. This happens before I call commit(). In my finally block I return the connection to the pool (I also set autoCommit back to whatever it was). The strange thing is that the inserts I have done are not rolled back, they are committed. I know I can fix this by adding a rollback to my finally block (I've actually done this, and it works), but I was sort of expecting an auto-rollback-if-not-committed. Also, I like to idiot-proof my code as much as possible, so if there's a way to get it to behave as I want it to automatically I'd prefer that. All advice welcome. Thanks. John Guthrie
В списке pgsql-jdbc по дате отправления: