[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3160) Support one-to-many list associations with constraints on both (owner_id, position) and (child_id)

Gail Badner (JIRA) noreply at atlassian.com
Tue Mar 4 19:09:33 EST 2008


Support one-to-many list associations with constraints on both (owner_id, position) and (child_id)
--------------------------------------------------------------------------------------------------

                 Key: HHH-3160
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3160
             Project: Hibernate3
          Issue Type: Sub-task
            Reporter: Gail Badner
            Assignee: Gail Badner


The logic used for removing entities from one-to-many list associations can cause ConstraintViolationException will be thrown if there are constraints on both (owner_id, position) and (child_id) in the "collection table". If the association is on a join table, the "collection table" is the join table; otherwise, the "collection table" is the child entity table..

Currently, SchemaExport does not put a constraint on (owner_id, position) when exporting one-to-many list associations on a foreign key. SchemaExport should be updated to also export this constraint.

See HHH-1268 for a description of how to reproduce this issue.

For one-to-many list associations on a foreign key, the workaround is to either define the constraint on (owner_id, position) in the child entity table as deferred. If this is not on option for a particular Dialect, the constraint on (owner_id, position) will have to be excluded. 

For a one-to-many list association on a join table, the workaround is to either define the constraint on (child_id) in the join table as deferred. If this is not on option for a particular Dialect, the constraint on (child_id) will have to be excluded. 

-- 
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