Re: Reg: 25P02, current transaction is aborted, commands ignored until end of transaction block
От | Robert Haas |
---|---|
Тема | Re: Reg: 25P02, current transaction is aborted, commands ignored until end of transaction block |
Дата | |
Msg-id | 603c8f070909301833w24b3529aw7f1b81f0d01fbf7b@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Reg: 25P02, current transaction is aborted, commands ignored until end of transaction block (ajay labade <ajaylabade@gmail.com>) |
Список | pgsql-bugs |
On Wed, Sep 30, 2009 at 5:23 AM, ajay labade <ajaylabade@gmail.com> wrote: >> =A0 =A0 I am trying to port my application from Oracle to PostGREs. I ha= ve a >> problem while doing so. In my application i need to update record if the >> delete on the respective record is failed due to Constraint Violation. B= ut >> SQL Error: 0, SQLState: 25P02 ERROR [JDBCExceptionReporter] ERROR: curre= nt >> transaction is aborted, commands ignored until end of transaction block = is >> being generated while updating the record. But with Oracle i am able to = do >> this. >> >> I have tried with latest Jar [postgresql-8.3-604.jdbc3.jar] too, but >> problem still exists. >> >> Here is the code that i worked on: >> >> try{ >> =A0 =A0 session =3D sessionManager.getSession(); >> =A0 =A0 transaction =3D session.beginTransaction(); >> =A0 =A0 session.delete(objects[i]); >> =A0 =A0 session.flush(); >> }catch(ConstraintViolationException e){ >> =A0 =A0 objects[i].setDeleted(Integer.valueOf(1)); >> =A0 =A0 session.saveOrUpdate(object[i]); >> =A0 =A0 session.flush(); >> } >> transaction.commit(); >> sessionManager.closeSession(session); This is not a bug. When an exception occurs in PostgreSQL, any further commands are ignored until the transaction is rolled back. In this case, you seem to be catching a ConstraintViolationException and then attempting to performing further database actions, which is bound to fail. You may want to ROLLBACK within your exception handler and then BEGIN again. ...Robert
В списке pgsql-bugs по дате отправления: