You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Thomas Fischer <fi...@seitenbau.net> on 2009/01/07 10:29:44 UTC

Antwort: Torque 3.3-RC3 possible bug ?

Please send questions to the Torque user list, not to the developers. 
Thanks.

> Torque 3.3-RC3 possible bug ?
> 
> Yannick Richard 
> 
> an:
> 
> fischer
> 
> 06.01.2009 15:25
> 
> Hi Thomas,
> 
> I am using Torque for a project at my company and we are upgrading 
> from 3.3-RC2 to 3.3-RC3.
> I am facing some problem while deleting in some circumstances, here 
> is an example of the code that do not work on 3.3-RC3:
> 
> public static void deleteNoteForSaleItem(BusinessBriefcase 
> briefcase, SaleItem saleItem) throws Exception {
>                 Criteria crit = new Criteria();
>                 crit.add(SaleItemNotePeer.SALE_ITEM_KY, 
> saleItem.getSaleItemKy());
>                 crit.addJoin(SaleItemNotePeer.NOTE_KY, 
NotePeer.NOTE_KY);
> 
>                 NotePeer.doDelete(crit, briefcase.getConn());
> }
> 
> Actually, what happens is that if saleItem.getSaleItemKy() do not 
> match any records primary key, it tries to delete everything and 
> some integrity constraints fire.
> What I did to correct it is to delete each note manually like in 
> following example:
> 
> public static void deleteNoteForSaleItem(BusinessBriefcase 
> briefcase, SaleItem saleItem) throws Exception {
>                 Criteria crit = new Criteria();
>                 crit.add(SaleItemNotePeer.SALE_ITEM_KY, 
> saleItem.getSaleItemKy());
>                 crit.addJoin(SaleItemNotePeer.NOTE_KY, 
NotePeer.NOTE_KY);
> 
>                 List<Note> noteList = NotePeer.doSelect(crit, 
> briefcase.getConn());
>                 for (Note note : noteList) {
>                                 NotePeer.doDelete(note, 
briefcase.getConn());
>                 }
> }
> 
> I saw that you worked on TORQUE-93 (http://issues.apache.org/jira/
> browse/TORQUE-93) that could be related to this.
> There is a lot of code in our application and RC3 won’t fit if this 
> problem can occur elsewhere in the application.
> 
> Could you help me shine some lights on this ?
> 
> Regards,
> Yannick Richard
> Matricis Informatique Inc.
>