You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by "Joel Becker (JIRA)" <em...@incubator.apache.org> on 2012/07/27 16:43:33 UTC

[jira] [Closed] (EMPIREDB-152) Error creating FKs on HSQLDB with DBSQLScript.run

     [ https://issues.apache.org/jira/browse/EMPIREDB-152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joel Becker closed EMPIREDB-152.
--------------------------------

    Resolution: Fixed

This error is caused by not having the primary key set on the table. Calling setPrimaryKey() for the table resolved the issue.
                
> Error creating FKs on HSQLDB with DBSQLScript.run
> -------------------------------------------------
>
>                 Key: EMPIREDB-152
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-152
>             Project: Empire-DB
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: empire-db-2.3.0
>         Environment: Windows 7 64-bit, Java 6 64-bit
>            Reporter: Joel Becker
>
> (Originally a user mailing list post: http://mail-archives.apache.org/mod_mbox/empire-user/201207.mbox/browser)
> 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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira