[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2709) Informix dialect generates incorrect ALTER TABLE statement

Ovidiu Feodorov (JIRA) noreply at atlassian.com
Wed Jul 4 00:11:52 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27400 ] 

Ovidiu Feodorov commented on HHH-2709:
--------------------------------------

The problem is not with the Dialect, but with the fact that ForeignKey.sqlConstraintString() hard codes "on delete cascade" at the end of foreign key string.

Shouldn't this kind of information be externalized in the Dialect, too?

I am thinking about something similar with (these are last lines of ForeignKey.sqlConstraintString()):

public String sqlConstraintString(...)
{
    ....
    if (!cascadeDeleteEnabled || !dialect.supportsCascadeDelete())
    {
       return result;
    }

    if (dialect.prependsCascadeDelete())
    {
        return  result + " on delete cascade";
    }
    else
    {
        return " on delete cascade " + result;
    }
}

To prevent existing deployments from breaking, prependsCascadeDelete() will return by default true;
The Informix Dialect that causes the trouble should be changed so prependsCascadeDelete() returns false.


> Informix dialect generates incorrect ALTER TABLE statement
> ----------------------------------------------------------
>
>                 Key: HHH-2709
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2709
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: metamodel
>    Affects Versions: 3.2.1, 3.2.2, 3.2.3, 3.2.4
>         Environment: Informix Dynamic Server 10.00.UC6, JDBC driver 3.00.JC3
>            Reporter: Ovidiu Feodorov
>
> org.hibernate.dialect.InformixDialect shipping with Hibernate 3.2.1 - 3.2.4 generates corrupted SQL, at least relative to Informix Dynamic Server 10.00.UC6.
> 2007-07-02 18:14:47,011 ERROR SchemaExport:274 - Unsuccessful: alter table A add constraint foreign key (B_ID) references collection constraint FK4AA13DBAA4271173 on delete cascade
> 2007-07-02 18:14:47,011 ERROR SchemaExport:275 - A syntax error has occurred.
> This is what the Dialect generates:
> alter table A add constraint foreign key ( B_ID) references collection constraint FKBC16C978A4271173 on delete cascade
> This is what works:
> alter table A add constraint foreign key (B_ID) references collection on delete cascade constraint FKBC16C978A4271173

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list