0

when I invoke query:

st.execute("create trigger myTrigger after insert on NEWPOPULATION for each row call "\NewPopulationTrigger\" ");

The console write: Class NewPopulationTrigger not found

How to should I follow the sentence "The trigger class must be available in the classpath of the database engine" - how can I implement it?

My research: The example of my issue /
adding classpath in scala

Community
  • 1
  • 1
murt
  • 3,790
  • 4
  • 37
  • 48

1 Answers1

1

The package must be given on the left of the class name.

In the H2 example. The package is org.h2.samples and the class is TriggerSample

CREATE TRIGGER INV_INS AFTER INSERT ON INVOICE
FOR EACH ROW CALL "org.h2.samples.TriggerSample"

The clean way in your case is to ask the full name in java:

st.execute("create trigger myTrigger after insert on NEWPOPULATION for each row call \""+NewPopulationTrigger.class.getName()+"\"");
nicolas-f
  • 539
  • 7
  • 17