Hi,

I'm getting the following error when using DBSQLScript.run() to create an
HSQLDB database:

2012-07-25 15:22:42,471 [main] ERROR org.apache.empire.db.DBSQLScript  -
java.sql.SQLException: Primary or unique constraint required on main table:
VOTERS in statement [-- creating foreign key constraint
absentee_ballo_registrant_i_FK --
ALTER TABLE absentee_ballots ADD CONSTRAINT absentee_ballo_registrant_i_FK
FOREIGN KEY (registrant_id) REFERENCES voters (id)]
java.sql.SQLException: Primary or unique constraint required on main table:
VOTERS in statement [-- creating foreign key constraint
absentee_ballo_registrant_i_FK --
ALTER TABLE absentee_ballots ADD CONSTRAINT absentee_ballo_registrant_i_FK
FOREIGN KEY (registrant_id) REFERENCES voters (id)]
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.empire.db.DBDatabaseDriver.executeSQL(DBDatabaseDriver.java:552)
at org.apache.empire.db.DBSQLScript.run(DBSQLScript.java:120)


Is the script being generated incorrectly?
This stackoverflow entry says it should be formatted differently:
http://stackoverflow.com/questions/10031613/hsql-error-when-attempting-to-create-foreign-key-constraint

Thanks,
Joel

Reply via email to