[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4455) Changes are not properly rollbacked after a bulk operation involving classes that use joined-subclass mapping

dilbert (JIRA) noreply at atlassian.com
Thu Jan 21 08:39:29 EST 2010


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

dilbert commented on HHH-4455:
------------------------------

Confirmed same bug with version 3.3.2.GA of hibernate-core (from maven repo), mysql-connector-java-5.1.9 and MySQL 5.1.42

> Changes are not properly rollbacked after a bulk operation involving classes that use joined-subclass mapping
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-4455
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4455
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.2.5, 3.3.0.SP1
>         Environment: Hibernate 3.2.5.ga and 3.3.0.SP1
> MySql database version 5.1.36
> Driver : mysql-connector-java-5.1.6
>            Reporter: dilbert
>         Attachments: TransactionTest.zip
>
>
> I have a Location class on which two other classes "depend" (Contact and LocationTransaction).
> When I want to delete a Location Object I use bulk update operations. First I delete the LocationTransactions
> connected to the Location object and then I delete the contact objects connected to the location object. Finally
> I delete the Location object itself. At the end I simulate that something went wrong and trigger a Rollback.
> After the rollback I would expect that none of the objects that I tried to delete was actually deleted. However,
> all the LocationTransaction objects are missing from the database after the rollback. Since the other objects
> are rollbacked properly I figure that the problem is connected to the fact that LocationTransactions is inherited
> from Transaction and uses joined-subclass mapping which is included in the test project in the attachment. 
>     private static void doTest() {
>         final Session s = sf.openSession();
>         final Transaction tx = s.beginTransaction();
>         try {
>             Location l = (Location) s.createQuery("from Location l where l.name = 'l1'").uniqueResult();
>             final Query deleteTransactionQuery = s.createQuery(
>                     "delete from LocationTransaction lt " +
>                     "where lt.location = (:location)");
>             deleteTransactionQuery.setParameter("location", l);
>             deleteTransactionQuery.executeUpdate();
>             final Query deleteContactQuery = s.createQuery(
>                     "delete from Contact c " +
>                     "where c.location = (:location)");
>             deleteContactQuery.setParameter("location", l);
>             deleteContactQuery.executeUpdate();
>             final Query deleteQuery = s.createQuery(
>                     "delete from Location l where l = (:location)");
>             deleteQuery.setParameter("location", l);
>             deleteQuery.executeUpdate();
>             //s.delete(l);
>             throw new RuntimeException("test");
>             //tx.commit();
>         } catch (Exception e) {
>             tx.rollback();
>             System.out.println(e);
>         } finally {
>             s.close();
>         }
>     }
> Please contact me with any further questions.
> Thanks for the help.

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