I am using IntelliJ IDEA as my IDE, and they have an option where you can
specify the Driver URL. I tested this connection and am able to connect to
the database, but when I add a new trigger:
public class VoteInsertTrigger extends TriggerAdapter {
@Override
public void fire(Connection conn, ResultSet oldRow, ResultSet newRow)
throws SQLException {
Statement statement = conn.createStatement();
boolean vote = newRow.getBoolean(newRow.findColumn("vote"));
int deckId = newRow.getInt("deck_id");
int value = vote ? 1 : -1;
String sql = "UPDATE DECKS SET DECKS.RATING=DECKS.RATING + %d WHERE
DECKS.ID=%d";
sql = String.format(sql, value, deckId);
statement.executeUpdate(sql);
}
}
With the command:
CREATE TRIGGER vote_insert
BEFORE INSERT
ON USERS_VOTES
FOR EACH ROW
CALL "com.chronpwn.chronpwn.data.VoteInsertTrigger"
it fails with: "cause: "org.h2.message.DbException: Class
""VoteInsertTrigger"" not found"
I rebuilt my entire project which puts the VoteInsertTrigger class in my
classpath.
When you mention "The trigger class must be available in the classpath of
the database engine," my entire project + the H2 jar are on the classpath,
so I would appreciate some insight on why this is happening. Thank you.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.