empire-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Döbele <doeb...@esteam.de>
Subject re: Error creating FKs on HSQLDB with DBSQLScript.run
Date Fri, 27 Jul 2012 07:41:27 GMT
IMO this looks like there is no primary key defined for the VOTERS table.

 

Please make sure that a primary key is set using setPrimaryKey(ID);

 

Are you still having this problem or has it been solved?

 

Regards

Rainer

 

from: Joel Becker [mailto:joelbecker0@gmail.com] 
to: user@empire-db.apache.org
re: Error creating FKs on HSQLDB with DBSQLScript.run

 

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

 


Mime
View raw message