I've got a web application that uses Hibernate and a 2.0.0 HSQLDB for data storage, and I'm trying to update it to use the latest 2.2.1 release of HSQL. However, I've run into some issues. I've since resolved most of them, but I have one problem I can't figure out.
Previously, when we declared our model objects, we declared them as both primary keys (using the @Id annotation) and unique. Apparently the new 2.2.1 HSQLDB doesn't like this, giving an error stating "a UNIQUE constraint already exists on the set of columns in statement...".
Removing this extraneous "unique" modifier on the model objects is not a problem. (In fact I'm not sure why it was ever added.) However, my issue comes when trying to upgrade a previous version of the database. I need to remove the unique constraint from the existing database in an SQL statement, but the only way I can find to do that is using a statement like:
ALTER TABLE [table_name] DROP CONSTRAINT [name_of_constraint];
But since Hibernate auto-generated the constraint I have no idea how to refer to it. Is this possible? is there another way to get rid of this constraint? Any hints or suggestions on how to tackle this problem would be appreciated.
Thanks!
|