[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-7002) SchemaExport ERROR when using in-memory database (H2) - drop constraint issue HHH000389
Christian Bauer (JIRA)
noreply at atlassian.com
Thu Jan 26 16:38:09 EST 2012
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-7002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45268#comment-45268 ]
Christian Bauer commented on HHH-7002:
--------------------------------------
Workaround/fix:
{code}
public class ImprovedH2Dialect extends H2Dialect {
@Override
public String getDropSequenceString(String sequenceName) {
// Adding the "if exists" clause to avoid warnings
return "drop sequence if exists " + sequenceName;
}
@Override
public boolean dropConstraints() {
// We don't need to drop constraints before dropping tables, that just leads to error
// messages about missing tables when we don't have a schema in the database
return false;
}
}
{code}
> SchemaExport ERROR when using in-memory database (H2) - drop constraint issue HHH000389
> ---------------------------------------------------------------------------------------
>
> Key: HHH-7002
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-7002
> Project: Hibernate ORM
> Issue Type: Bug
> Components: core
> Affects Versions: 4.0.1
> Environment: H2Dialect, Hibernate 4.0
> Reporter: andrea handevidt
> Priority: Minor
> Labels: hibernate
> Attachments: HibernateError.zip
>
>
> HHH-000389 resolved an issue with property name="hibernate.hbm2ddl.auto" value="create". It now performs a drop prior to create. When using an in-memory database this will throw errors on table with foreign key constraints.
> ERROR (SchemaExport:426) - HHH000389: Unsuccessful: alter table security_key drop constraint FK3031A4E0BE21E8D7
> ERROR (SchemaExport:427) - Table "SECURITY_KEY" not found; SQL statement:alter table security_key drop constraint FK3031A4E0BE21E8D7
> I noticed that the sqlDropString for org.hibernate.mapping.Table appends "if exists". This is missing for org.hibernate.mapping.ForeignKey.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list