Antwort: Torque 3.3-RC3 possible bug ?

Thomas Fischer <[email protected]>
Newsgroups gmane.comp.jakarta.turbine.torque.user
Message-ID <OF82F28AFC.7D47C0FA-ONC1257537.003403A3-C1257537.003429BB@seitenbau.net>
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.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.