[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3783) Save throws unique constraint violation: Object having a composite-key with constraint on one of the columns

Soorjith Kombilath (JIRA) noreply at atlassian.com
Wed Feb 25 07:32:38 EST 2009


Save throws unique constraint violation: Object having a composite-key with constraint on one of the columns
------------------------------------------------------------------------------------------------------------

                 Key: HHH-3783
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3783
             Project: Hibernate Core
          Issue Type: Bug
         Environment: HIbernate 3.2.5.ga; Database: Oracle
            Reporter: Soorjith Kombilath


I have a hibernate object with composite key -
      <composite-id>
         <key-many-to-one name="parent" column="PARENT_NUMBER"       class="com.test.entity.impl.ParentImpl" />
         <key-property name="restraintCode" column="RESTRAINT_CDE" type="string" />
      </composite-id>
In database there is a unique index on PARENT_NUMBER. 
Parent object may contain a collection of chjld objects.

Whenever a child object is removed and a new child object is added, it throws unique constraint  violation error.
When I check the queries generated, hibernate is executing the queries for INSERT before executing DELETE. Is there any way to enforce DELETE before INSERTS? or am I missing to specify some attribute in my mapping? 

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