ORM entityDelete() bug?

Mach-II , ColdFusion Add comments

I'm still trying to wrap my head around the relationships in ORM. Yesterday I wanted to delete all the child entities with the parent is delete. No problem, there is an attribute for that. cascade="all-delete-orphan". Well, it wasn't working for me.

It turned out, in my Mach-II app I was using event-bean (by mistake) to prepare the bean and then calling EntityDelete() on it. The entity was getting deleted but the child entities were not getting deleted. No error either. Once I realized my mistake (event-bean), and changed to call-method to load the entity and then call entityDelete() on it everything worked fine.

So, what is the bug? Here is the code equivalent (artist-art example) of my mumbo-jumbo above:



var artist = new Artist();


artist.setArtistID(1);


entityDelete(artist);


In the code above artist is a transient object and I believe it should _not_ delete the record from the database. It should either throw error or ignore the delete. As it stands, it will delete the artist but not the arts, even with cascade="all-delete-orphan".  It even behaves a little funcky with inverse="true" option on relationship. 

Here is the code that works properly:



var artist = entityLoad("Artist", 1, true);


entityDelete(artist);


Here is thread on ORM google groups with examples:

http://groups.google.com/group/cf-orm-dev/browse_thread/thread/1d924dcc28185ddd

 

 

 

2 responses to “ORM entityDelete() bug?”

  1. swiss replica watches Says:
    <a href="http://www.sensible-watches.com/ ">swiss replica watches</a>
    <a href="http://www.sensible-watches.com/Rolex/Submariner/ ">Submariner</a>
    <a href="http://www.sensible-watches.com/Rolex/Masterpiece/ ">Masterpiece</a>
    <a href="http://www.sensible-watches.com/Rolex/GMT-Maste/ ">GMT Maste</a>
    <a href="http://www.sensible-watches.com/Rolex/Daytona/ ">Daytona</a>
    <a href="http://www.sensible-watches.com/Rolex/DayDate/ ">DayDate</a>
    <a href="http://www.sensible-watches.com/Rolex/DateJust/ ">DateJust</a>
    <a href="http://www.sensible-watches.com/Rolex/Cellini-Prince/ ">Cellini Prince</a>
    <a href="http://www.sensible-watches.com/Rolex/Swiss-Rolex/ ">Swiss Rolex</a>
  2. zhizishou Says:
    <a href="http://www.albatouristik.com">p90x Workout</a>
    only for your healthy
    <a href="http://www.rosetta-stone-shop.net">Rosetta Stone</a>
    enjoy your learning another language
    <a href="http://www.itunes-gift-cards.org">itunes gift card app store</a>
    good chioce or your friends and relataves
    <a href="http://www.highwaytowatches.com">swiss replica watches</a>
    <a href="http://www.watches-mens.com">mens watches</a>
    <a href="http://www.cnaweb.net/product/fitness_programs/insanity.shtml">insanity workout DVD price,insanity workout.com</a>
    <a href="http://www.cnaweb.net/product/fitness_programs/turbofire.shtml">Turbo Jam Workout DVD,Turbo Jam.com</a>
    <a href="http://www.cnaweb.net/product/fitness_programs/turbofire.shtml">Turbo Fire Workout DVD,Turbo Fire.com</a>
    <a href="http://www.cnaweb.net/product/fitness_programs/body-gospel.shtml">Body Gospel Workout DVD,Body Gospel.com</a>
    <a href="http://www.cnaweb.net/product/fitness_programs/power90.shtml">Power 90 Workout DVD,Power 90.com</a>
    <a href="http://www.cnaweb.net/product/fitness_programs/brazil_butt_lift.shtml">Brazil Butt Lift Workouts DVD</a>
    <a href="http://www.cnaweb.net/product/fitness_programs/best_sellers/slim_in_6.shtml">Slim in 6 Workout DVD,Slim in 6.com</a>
    <a href="http://www.cnaweb.net/product/fitness_programs/hip_hop_abs.shtml">Hip Hop Abs Workout DVD,Hip Hop Abs.com</a>

Leave a Reply





Powered by Mango Blog. Design and Icons by N.Design Studio