Subject: [Pljava-dev] Possible bug in trigger annotations

From: Petr Michálek <[email-masked]>
Date: Sun, 7 Feb 2016 23:34:34 +0100

Hi,

generation of pljava.ddr by java annotations is OK, but on trigger
execution returns an exception:

"org.postgresql.util.PSQLException: ERROR: Triggers can not have a java
parameter declaration."

Workaround is replace "(org.postgresql.pljava.TriggerData)" with "" in file
pljava.ddr
Please confirm the bug or tell me what I'm doing wrong.

And I have little comment to documentation. I didn't found if the javac
generate pljava.ddr or annotation is read by deployer. For example IDE
(Eclipse) does not generate pljava.ddr (do not know why) and I must run
javac.

Petr
_______________________________________________
Pljava-dev mailing list
[email-masked]
http://lists.pgfoundry.org/mailman/listinfo/pljava-dev

---

From: Chapman Flack <[email-masked]>
Date: Sun, 07 Feb 2016 18:32:22 -0500

> Please confirm the bug or tell me what I'm doing wrong.

Bug. I've opened https://github.com/tada/pljava/issues/92 for it. Thanks!

> (Eclipse) does not generate pljava.ddr (do not know why) and I must run

I am not sure exactly what you are asking, but as far as how pljava.ddr
is generated, it is generated by the Java compiler at the same time as
it compiles classes.

The pljava-api jar file has to be on the classpath given to the compiler,
so the compiler finds the generator class.  For example, the Hello example

https://tada.github.io/pljava/use/hello.html

shows building with Maven, with pljava-api added as a dependency; that
automatically puts pljava-api's jar file on the compiler classpath.
If you run javac by hand, of course you can add that jar with -cp.
(If you do not have the separate pljava-api jar, you can point the
compiler to the full pljava jar, which also contains all the api classes.
Come to think of it, I should add pljava-api to what gets packaged in
the self-extracting jar.)

Ordinarily, you would notice if that jar were not on the classpath, because
the compiler would not find the annotation classes.

As to why Eclipse does not generate the file, I have no immediate answer.
Does Eclipse have any settings to enable/disable annotation processing?
If you find the solution before I do I'll happily add it in an Eclipse
special topic in the docs.

Even when using javac or maven, I do find it useful to do a clean before
every recompile. Otherwise, sometimes the tools will be 'smart' and
run the compiler on only some source files that have changed, and then
the generated ddr will be incomplete, containing only what was in the files
the compiler looked at. That is definitely something I should add to docs.

-Chap

---

From: Chapman Flack <[email-masked]>
Date: Sun, 07 Feb 2016 19:56:15 -0500

> Bug. I've opened https://github.com/tada/pljava/issues/92 for it. Thanks!

I have pushed the fix on both the master and the REL1_5_STABLE branch
(which is now beyond 1.5.0-BETA1).  If you want it now you can checkout
the branch directly, or after some more days/bugs I will probably make
a -BETA2 or -RC.

-Chap