[Pljava-dev] Problem with primary key

From: thomas at tada(dot)se (Thomas Hallgren)
To:
Subject: [Pljava-dev] Problem with primary key
Date: 2006-05-18 07:35:33
Message-ID: 446C23C5.207@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Eric BOYER wrote:
> Thomas Hallgren a ?crit :
>
>> Eric,
>> You say that you re-throw the exception in your catch. Yet, in your
>> example you don't do that. Also, to do an e.printStackTrace() might
>> be a bad idea sometimes. If the postmaster runs as a service, there
>> will be no System.out assigned.
>>
>>
> It was a simple test. In reality, we use log4j !
Really? Why is that? You are aware that PL/Java is adapting the standard
java.util.logging stuff on top of the PostgreSQL logger? More info here:
http://wiki.tada.se/display/pljava/Logging

> OK but we wan't catch exception for different reasons ...

You must use savepoints if you plan to catch SQLExceptions without
throwing them again (see:
http://wiki.tada.se/display/pljava/Exception+handling) If you don't it
really shouldn't matter if you catch a ServerException (the subclass of
SQLException that you must have encountered). That exception will always
be re-thrown and cause a rollback once your method returns. And that's
regardless of if you catch it or not.

The fact that the backend reached an unstable state actually indicates a
bug in PL/Java. My guess is that the endless recursion that you caused
somehow messed up the internal error handling. I'll look into that.

Regards,
Thomas Hallgren

In response to

Browse pljava-dev by date

  From Date Subject
Next Message Marek Lewczuk 2006-05-18 10:45:07 [Pljava-dev] ResultSet getString
Previous Message Eric BOYER 2006-05-18 07:14:43 [Pljava-dev] Problem with primary key