Seems like an application requiring a CMP Persistence Manager and EJB container to execute SQL in a specific order might be asking a bit much to me... -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, June 18, 2001 12:39 PM To: [EMAIL PROTECTED] Subject: [JBoss-dev] [ jboss-Bugs-434227 ] ejbStore delay can lead to DB corruption Bugs item #434227, was updated on 2001-06-18 09:39 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=376685&aid=434227&group_id= 22866 Category: JBossCMP Group: v2.2 (stable) Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: ejbStore delay can lead to DB corruption Initial Comment: The "caching" of database updates until the end of a transaction can lead to data corruption if RI constraints are in place. Example: CreditCard cc = cch.findByPrimaryKey(creditCardID); CreditCardRecord ccr = cc.getRecord(); //Get the address that this credit card is currently pointing to MemberCompanyAddress mca = mcah.findByPrimaryKey(new MemberCompanyAddressPK(ccr.billing_address_id)); //Change the address to a different one ccr.billing_address_id = newBillingAddressID.intValue (); //Write the changes to the bean object cc.setRecord(ccr); //Remove the old address mca.remove(); Because the "UPDATE" that the setRecord() call is delayed until the end of the TX, the call to remove() is operating on the old snapshot of the database, not the post-UPDATE state that the developer expects. Corruption can result if a ON DELETE CASCADE RI constraint is on the Address table. (As this will remove the underlying CreditCard record) Two possible solutions: Allow a developer to force a flush of the "transaction cache" to the DB Automatically flush bean object "setXXX()" operations to the DB based on the state of a flag in the deployment descriptor. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=376685&aid=434227&group_id= 22866 _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development