I'm only a newbie at writing CMP beans using JBoss, but I think JBoss implements 'cascade deletes' by first removing the 'parent' entity first (e.g., your entity A) and then removes all related children (e.g., your entity B).
I suspect that if you had written the DB I/O code yourself, you would have reversed the order of processing (like I would have). But it seems JBoss removes the parent entities first in a cascade delete operation. Consequently, it tries to maintain some level of consistency during this transaction by setting the 'A' key in your 'B' table record to NULL for all related 'B' records. Then it whacks the 'B' records. Issues: 1) Is this really a problem? I struggled with this myself. It seems that the definition of a transaction for a 'remove()' operation in JBoss CMP containers is quite large -- remove the parent records first and then the child records. I've written quite a few tests to see if I could break the system and I couldn't (good!). 2) You might be thinking in 'data model' mode vs. 'object model' mode. I also created my data model first given the dozens of applications I wrote (before CMP beans) and then tried to put CMP beans on top of it. I ran into all sorts of problems. In the end, I designed my beans first and then created the tables below the beans (and did *not* use foreign key constraints). As long as I properly designed the beans so that the only way to add a child bean was to create an 'addChild (B)' business method on my A bean. Seems to work pretty well. But like I said, I'm still a newbie at this..... R View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3853087#3853087 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3853087 ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
