agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] ResultSet is read-only error for Trigger?
3+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] ResultSet is read-only error for Trigger?
@ 2008-03-05 17:03  
  0 siblings, 1 reply; 3+ messages in thread

From:  @ 2008-03-05 17:03 UTC (permalink / raw)

I'm trying to do a very simple trigger  before moving onto the complex
stuff that I need pljava for.

My Java code is extremely simple:
    public static void ProvisionOrder2(TriggerData td) throws
SQLException {
               
            ResultSet _new = td.getNew();
            _new.updateBoolean("provisioningcomplete",true);
     }

My trigger setup is likewise pretty simple:
		CREATE OR REPLACE FUNCTION provisionorder()
		  RETURNS "trigger" AS
	
'com.prodeasystems.rsc.prvstester.Provisioning.ProvisionOrder2'
		  LANGUAGE 'java' VOLATILE;
		ALTER FUNCTION provisionorder() OWNER TO postgres;

		CREATE TRIGGER provisionorder_trigger
		  AFTER UPDATE
		  ON serviceproviderprovisioned
		  FOR EACH ROW
		  EXECUTE PROCEDURE provisionorder();

When I update my row, I see the following error:
provision=# update serviceproviderprovisioned set
readytoprovision='true' where rhcjid='x';
ERROR:  org.postgresql.pljava.jdbc.UnsupportedFeatureException: Feature
not supported: ResultSet is read-only


The example provided in the users guide
(http://wiki.tada.se/display/pljava/Triggers) implies that the
ResultSets can be manipulated.  Why am I seeing this error?

Michael Toler
System Test Engineer
Prodea Systems, Inc.
214-278-1834 (office)
972-816-7790 (mobile)




This message is confidential to Prodea Systems, Inc unless otherwise indicated 
or apparent from its nature. This message is directed to the intended recipient 
only, who may be readily determined by the sender of this message and its 
contents. If the reader of this message is not the intended recipient, or an 
employee or agent responsible for delivering this message to the intended 
recipient:(a)any dissemination or copying of this message is strictly 
prohibited; and(b)immediately notify the sender by return message and destroy 
any copies of this message in any form(electronic, paper or otherwise) that you 
have.The delivery of this message and its information is neither intended to be 
nor constitutes a disclosure or waiver of any trade secrets, intellectual 
property, attorney work product, or attorney-client communications. The 
authority of the individual sending this message to legally bind Prodea Systems  
is neither apparent nor implied,and must be independently verified.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20080305/ac930bd2/attachment.html;



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [Pljava-dev] ResultSet is read-only error for Trigger?
@ 2008-03-05 17:31  
  parent: 
  0 siblings, 1 reply; 3+ messages in thread

From:  @ 2008-03-05 17:31 UTC (permalink / raw)



On Wed, 5 Mar 2008, Mike Toler wrote:

> I'm trying to do a very simple trigger  before moving onto the complex
> stuff that I need pljava for.
>
> 		CREATE TRIGGER provisionorder_trigger
> 		  AFTER UPDATE
> 		  ON serviceproviderprovisioned
> 		  FOR EACH ROW
> 		  EXECUTE PROCEDURE provisionorder();
>
> When I update my row, I see the following error:
> ERROR:  org.postgresql.pljava.jdbc.UnsupportedFeatureException: Feature
> not supported: ResultSet is read-only
>

I think the problem is that you're using an after trigger instead of a 
before trigger.  Before the update you can manipulate the values and have 
them persisted, but after the update you get the values that did come 
through and it's read-only at that point.

Kris Jurka




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [Pljava-dev] ResultSet is read-only error for Trigger?
@ 2008-03-05 18:09  
  parent: 
  0 siblings, 0 replies; 3+ messages in thread

From:  @ 2008-03-05 18:09 UTC (permalink / raw)

Yep.  That was it. 

Thanks.

Now I'm onto the more complex issues.



Michael

> -----Original Message-----
> From: Kris Jurka [mailto:books at ejurka.com]
> Sent: Wednesday, March 05, 2008 11:32 AM
> To: Mike Toler
> Cc: pljava-dev at pgfoundry.org
> Subject: Re: [Pljava-dev] ResultSet is read-only error for Trigger?
> 
> 
> 
> On Wed, 5 Mar 2008, Mike Toler wrote:
> 
> > I'm trying to do a very simple trigger  before moving onto the
complex
> > stuff that I need pljava for.
> >
> > 		CREATE TRIGGER provisionorder_trigger
> > 		  AFTER UPDATE
> > 		  ON serviceproviderprovisioned
> > 		  FOR EACH ROW
> > 		  EXECUTE PROCEDURE provisionorder();
> >
> > When I update my row, I see the following error:
> > ERROR:  org.postgresql.pljava.jdbc.UnsupportedFeatureException:
Feature
> > not supported: ResultSet is read-only
> >
> 
> I think the problem is that you're using an after trigger instead of a
> before trigger.  Before the update you can manipulate the values and
have
> them persisted, but after the update you get the values that did come
> through and it's read-only at that point.
> 
> Kris Jurka



This message is confidential to Prodea Systems, Inc unless otherwise indicated 
or apparent from its nature. This message is directed to the intended recipient 
only, who may be readily determined by the sender of this message and its 
contents. If the reader of this message is not the intended recipient, or an 
employee or agent responsible for delivering this message to the intended 
recipient:(a)any dissemination or copying of this message is strictly 
prohibited; and(b)immediately notify the sender by return message and destroy 
any copies of this message in any form(electronic, paper or otherwise) that you 
have.The delivery of this message and its information is neither intended to be 
nor constitutes a disclosure or waiver of any trade secrets, intellectual 
property, attorney work product, or attorney-client communications. The 
authority of the individual sending this message to legally bind Prodea Systems  
is neither apparent nor implied,and must be independently verified.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2008-03-05 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 17:03 [Pljava-dev] ResultSet is read-only error for Trigger? 
2008-03-05 17:31 ` 
2008-03-05 18:09   ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox