You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "Thomas Fischer (JIRA)" <ji...@apache.org> on 2007/05/05 13:39:16 UTC

[jira] Created: (TORQUE-93) Joins in Criteria used to delete data can delete datasets also in joined table

Joins in Criteria used to delete data can delete datasets also in joined table
------------------------------------------------------------------------------

                 Key: TORQUE-93
                 URL: https://issues.apache.org/jira/browse/TORQUE-93
             Project: Torque
          Issue Type: Bug
          Components: Runtime
            Reporter: Thomas Fischer
         Assigned To: Thomas Fischer
            Priority: Critical


Code to reproduce the error:
criteria.add(BookPeer.AUTHOR_ID, authorId);
criteria.addJoin(AuthorPeer.AUTHOR_ID, BookPeer.AUTHOR_ID);
// the following is not needed from a SQL point of view but to generate the unexpected behaviour
criteria.add(AuthorPeer.AUTHOR_ID, authorId);
BookPeer.doDelete(criteria);

Additionally to deleting the chosen books, this will also delete the corresponding authors. What happens is that the criteria gets passed to BasePeer, which tries to figure the table to delete from from the criteria alone. But as it contains two tables in the where clause, it does not know which one is the right table, and deletes the data from both tables.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


[jira] Closed: (TORQUE-93) Joins in Criteria used to delete data can delete datasets also in joined table

Posted by "Thomas Fischer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TORQUE-93?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Fischer closed TORQUE-93.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 3.3-RC3

> Joins in Criteria used to delete data can delete datasets also in joined table
> ------------------------------------------------------------------------------
>
>                 Key: TORQUE-93
>                 URL: https://issues.apache.org/jira/browse/TORQUE-93
>             Project: Torque
>          Issue Type: Bug
>          Components: Runtime
>            Reporter: Thomas Fischer
>         Assigned To: Thomas Fischer
>            Priority: Critical
>             Fix For: 3.3-RC3
>
>
> Code to reproduce the error:
> criteria.add(BookPeer.AUTHOR_ID, authorId);
> criteria.addJoin(AuthorPeer.AUTHOR_ID, BookPeer.AUTHOR_ID);
> // the following is not needed from a SQL point of view but to generate the unexpected behaviour
> criteria.add(AuthorPeer.AUTHOR_ID, authorId);
> BookPeer.doDelete(criteria);
> Additionally to deleting the chosen books, this will also delete the corresponding authors. What happens is that the criteria gets passed to BasePeer, which tries to figure the table to delete from from the criteria alone. But as it contains two tables in the where clause, it does not know which one is the right table, and deletes the data from both tables.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org