[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2830) Insert error ignored when using sybase generated identity column

strong liu (JIRA) noreply at atlassian.com
Thu Aug 6 03:55:14 EDT 2009


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

strong liu commented on HHH-2830:
---------------------------------

I tried the method you mentioned in HHH-2503,  it seems don't work with this issue, and HHH-2388 in Branch_3_2_4_SP1_CP

> Insert error ignored when using sybase generated identity column
> ----------------------------------------------------------------
>
>                 Key: HHH-2830
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2830
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.2
>         Environment: Hibernate 3.2.2, Sybase 12.5.3
>            Reporter: Martin van Dijken
>            Assignee: Diego Plentz
>         Attachments: create-test-tables.sql, TestExchangeRate.hbm.xml, TestExchangeRate.java, TestRateOwner.hbm.xml, TestRateOwner.java, TestRateTest.java
>
>
> All our tables have a single database generated identity column. This column is specified in Sybase as:
> objectId numeric(12) identity
> A little while ago, Hibernate started throwing NonUniqueObjectExceptions upon insert of a certain object. It turns out, the insert statement could not possibly succeed as the value of one of the columns was larger than the database column. The error is however ignored because Hibernate generates a query:
> insert into objectTable (objectName, objectNumericErrorField) values (?,?) select @@ identity
> The value of objectNumericErrorField was larger than the database column allows. The insert statement would therefore fail. The select @@identity however would succeed, only because no new row was inserted it would return the previous ID. 
> Hibernate then assumes the entire query worked fine and would assign the already assigned id to a different object. It would then check whether or not the id was already in use and throw a NonUniqueObjectException

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