[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2547) Incorrect update strings when using rowid

Gail Badner (JIRA) noreply at atlassian.com
Fri Apr 13 13:56:04 EDT 2007


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

Gail Badner commented on HHH-2547:
----------------------------------

While debugging, I figured out why the update causes "ORA-01410: invalid ROWID".

The rowid from the subclass table is being bound to the update query on the base class. 

In the example above, when the rowid is bound to the update statement:

   update Point set description=? where rowid=? 

the actual value that is bound is the rowid for the entity in the NamedPoint table (AAAUlTAAEAAAAe0AAA), when it should have been  the rowid in the Point table (AAAUlSAAEAAAAOkAAA).

The ORA-01410 is due to a rowid that is not found in the Point table.

This happens both before and after HHH-2547.patch is applied.  

> Incorrect update strings when using rowid
> -----------------------------------------
>
>                 Key: HHH-2547
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2547
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.3
>         Environment: Oracle 10.2.0.1.0; Oracle JDBC 10.2.0.3
>            Reporter: Gail Badner
>            Priority: Minor
>         Attachments: HHH-2547-test-corrected.patch, HHH-2547-test.patch, HHH-2547.patch, HHH-2547.patch-test
>
>
> The fix for HHH-2469 introduced a new bug when an update spans more than one table.
> I've added a joined subclass, NamedPoint, to org.hibernate.test.rowid.RowIdTest and added a new test that reproduces the problem. Using this test case, the fix for HHH-2469 results in the following update strings:
> update Point set description=? where rowid=?
> update Point set description=? where \"x\"=? and \"y\"=?
> update NamedPoint set name=? where \"x\"=? and \"y\"=?
> The first statement is the intended optimization for the second statement. This optimization is supposed to replace the second (default) update statement.
> Because the update spans two tables, AbstractEntityPersister.update() will only execute the first and second statements. The update to subclass properties will not be executed.
> The second statement will be omitted by replacing:
>     System.arraycopy( sqlUpdateStrings, 0, result, 1, getTableSpan() );
> with:
>     if ( getTableSpan() > 1 ) {
>       System.arraycopy( sqlUpdateStrings, 1, result, 1, getTableSpan() - 1 );
>     }
>  
> Another problem cropped up when executing the test case that updates a NamedPoint. When an entity is read, the rowid is correct, but by the time the update is done, the rowid is somehow incremented and the query fails with "ORA-01410: invalid ROWID". In a test, I verified that the rowid was "AAAUlSAAEAAAAOkAAA" when the entity when read from the database, but the value that was bound to the prepared statement was "AAAUlTAAEAAAAe0AAA". After the test failed, the rowid in the database is still "AAAUlSAAEAAAAOkAAA". I have not figured out where or why the rowid is being modified, but it makes it impossible to use this optimization when the update spans more than one table.
> I'll attach patches for AbstractEntityPersister and the updated test shortly.
> Gail Badner
> SourceLabs - http://www.sourcelabs.com
> Dependable Open Source Systems 

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