Ok, makes sense, the exception is indeed quite self-explaining
On 27 July 2012 09:54, Rainer Döbele <[email protected]> wrote: > > Don't think this is our business. > > The database knows and provides us with the correct exception and the reason. > We cannot pre-check what is feasible and unfeasible with DLL statements for > all existing databases - and why should we? > The individual statements are all correct. > > Regards > Rainer > > >> -----Ursprüngliche Nachricht----- >> Von: Francis De Brabandere [mailto:[email protected]] >> Gesendet: Freitag, 27. Juli 2012 09:47 >> An: [email protected] >> Betreff: Re: Error creating FKs on HSQLDB with DBSQLScript.run >> >> If that's the case then we should throw an exception to help the user fix >> this >> >> F >> >> On 27 July 2012 09:41, Rainer Döbele <[email protected]> wrote: >> > 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:[email protected]] >> > to: [email protected] >> > 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.jav >> a >> > :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 >> > >> >
