[hibernate-issues] [Hibernate-JIRA] Commented: (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 23:36:38 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32511#action_32511 ] 

Soorjith Kombilath commented on HHH-3783:
-----------------------------------------


This was solved by following the work-around given in HHH2801.
--------------------------------------------------------------------------------------------------
[ Permlink | « Hide ]
Martin Kartumovich - 25/Feb/09 10:10 AM
There is a workaround for this problem, at least with Oracle: Deferred Contraints (http://www.remote-dba.cc/t_garmany_easysql_deferred_constraints.htm).
Deferred constraints won't be checked till the transaction commits, not on each statement - which is the default behaviour.
---------------------------------------------------------------------------------------------------
Thanks


> 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
>            Assignee: Gail Badner
>
> 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