[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-4810) Persistent immutable and read-only entities are updated before being deleted

Gail Badner (JIRA) noreply at atlassian.com
Wed Feb 10 02:15:30 EST 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner updated HHH-4810:
-----------------------------

    Fix Version/s:     (was: 3.5.0-Next)
                   3.5

> Persistent immutable and read-only entities are updated before being deleted
> ----------------------------------------------------------------------------
>
>                 Key: HHH-4810
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4810
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.0-Beta-3
>            Reporter: Gail Badner
>            Assignee: Gail Badner
>             Fix For: 3.5
>
>
> Read-only and immutable entities that are in persistent state when deleted are updated before being deleted. Read-only and immutable entities that are detached when deleted are not updated before being deleted.
> In the following examples, Contract is an immutable class.
> Example 1: Immutable entity is updated with the same property values as just read
> s = openSession();
> t = s.beginTransaction();
> c = (Contract) s.get( Contract.class, c.getId() );
> s.delete(c);
> t.commit();
> s.close();
> Hibernate: update Contract set customerName=?, type=? where id=?
> 17:59:32,640 TRACE StringType:151 - binding 'gavin' to parameter: 1
> 17:59:32,640 TRACE StringType:151 - binding 'phone' to parameter: 2
> 17:59:32,641 TRACE LongType:151 - binding '1' to parameter: 3
> ... (immutable collection, Contract.getVariations() is also updated and deleted)
> Hibernate: delete from Contract where id=?
> 17:59:32,654 TRACE LongType:151 - binding '1' to parameter: 1
> -------------------------------------------------------------------------
> Example 2: Immutable entity is updated with a new property value before being deleted
> s = openSession();
> t = s.beginTransaction();
> c = (Contract) s.get( Contract.class, c.getId() );
> c.setCustomerName( "Sherman" );
> s.delete(c);
> t.commit();
> s.close();
> Hibernate: update Contract set customerName=?, type=? where id=?
> 17:59:33,221 TRACE StringType:151 - binding 'Sherman' to parameter: 1
> 17:59:33,221 TRACE StringType:151 - binding 'phone' to parameter: 2
> 17:59:33,222 TRACE LongType:151 - binding '6' to parameter: 3
> ... (immutable collection, Contract.getVariations() is also updated and deleted)
> Hibernate: delete from Contract where id=?
> 17:59:33,242 TRACE LongType:151 - binding '6' to parameter: 1
> Example 3: No update when the immutable entity is detached when it is deleted.
> s = openSession();
> t = s.beginTransaction();
> s.delete( c );
> t.commit();
> s.close();
> ... (immutable collection, Contract.getVariations() is deleted)
> Hibernate: delete from Contract where id=?
> 17:59:33,337 TRACE LongType:151 - binding '8' to parameter: 1

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