With BMP I would implement a more complex method (or methods across the
beans) which handle all the stuff in one shot and in the right order.  I
would just put the needed SQL right into the business methods.

The issue here is that he's trying to compose a single larger operation from
3 small operations that are order dependent, but CMP EJB doesn't provide any
guarantee on the order of execution.  It says things like the container can
sync state when it wants, or the container can defer the execution of remove
from persistent store until the end of transaction.  It doesn't say that
it's supposed to support declarative RI constraints in the persistent store.

Don't get me wrong, I'm not saying EJB should blow off RI, just that the
current specs seem to reserve RI for the container and don't really do
anything to support it in the database.  There is no reason that JAWS can't
be smart enough to allow the database to do the RI thing, it'd just be a
bunch of work (which I'm not volunteering to do!)

Some database products (Oracle) allow you to defer RI checking until commit
time which allows you to avoid this type of problem.

Cheers

-----Original Message-----
From: Bill Burke
To: [EMAIL PROTECTED]
Sent: 6/18/01 4:34 PM
Subject: RE: [JBoss-dev] [ jboss-Bugs-434227 ] ejbStore delay can lead toDB
corruption

You'd have the same type of problems with BMP, wouldn't you?

Bill

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Jay
> Walters
> Sent: Monday, June 18, 2001 3:35 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-dev] [ jboss-Bugs-434227 ] ejbStore delay can lead
> toDB corruption
>
>
> 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



_______________________________________________
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

Reply via email to