I'm currently trying to load a sql script to create a HSQL database. This is done by using the following code:
Resource resource = new ClassPathResource("/create-table.sql");
SimpleJdbcTestUtils.executeSqlScript(template, resource, Boolean.FALSE);
The script contains the create statement of a trigger:
CREATE TRIGGER t BEFORE UPDATE ON SUBJECTS
REFERENCING NEW AS newrow OLD AS oldrow
FOR EACH ROW
BEGIN ATOMIC
SET newrow.VERSION = oldrow.VERSION + 1;
END;
When running the tests using this code, the following error occurs:
Caused by: java.sql.SQLException: Unexpected end of command: REFERENCING in statement
[CREATE TRIGGER t BEFORE UPDATE ON SUBJECTS REFERENCING]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.executeUpdate(Unknown Source)
at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
at org.springframework.jdbc.core.JdbcTemplate$1UpdateStatementCallback.doInStatement(JdbcTemplate.java:508)
at org.springframework.jdbc.core.JdbcTemplate$1UpdateStatementCallback.doInStatement(JdbcTemplate.java:1)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395)
I'm using Spring 3.0.5 and HSQLDB (driver,...) version is 1.8.0.10.
Has anyone ever had this problem or knows how to solve this?
(I also tried to place everything on one line, placed the sql in a separate file, removed semicolons, ...)
Any help will be much appreciated. Thanx in advance!
Wendy.