• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Many-to-Many relationship remove... failed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Many-to-Many relationship remove... failed


  • Subject: Many-to-Many relationship remove... failed
  • From: Erwin <email@hidden>
  • Date: Mon, 6 Sep 2004 16:43:32 +0200

  I have 2 classes  Customer and Product
Customer has 1-many relationship to Suggestion
Product has 1-many relationship to Suggestion
so I ended with a flattened many-to-many relationship
suggestedProducts between Customer and Product

I try to suppress a suggestion from this many-to-many relationship but
I always get an exception :

[2004-09-06 16:38:32 CEST] <main> Waiting for requests...
[2004-09-06 16:39:06 CEST] <WorkerThread1> An exception occurred while
trying to remove a product:
com.webobjects.eoaccess.EOGeneralAdaptorException:
lockRowComparingAttributes -- com.webobjects.jdbcadaptor.JDBCChannel:
lock operation locked more than one row

what's wrong ?  thanks for your help


here are some pieces of involved code
CustomerDetailPage.java
......
   protected EOEnterpriseObject currentCustomer;
   protected EOEnterpriseObject aSuggestedProduct;
........
     public EOEnterpriseObject currentCustomer(){
         return currentCustomer;
     }

     public void setCurrentCustomer(EOEnterpriseObject
newCurrentCustomer){
         currentCustomer = newCurrentCustomer;
     }

     public EOEnterpriseObject aSuggestedProduct() {
         return aSuggestedProduct;
     }

    public void setASuggestedProduct(EOEnterpriseObject
newASuggestedProduct){
         aSuggestedProduct = newASuggestedProduct;
     }

     public WOComponent removeSuggestion() {
		((Customer)
this.currentCustomer()).removeFromSuggestedProducts((Product)
aSuggestedProduct());
		((Product)
this.aSuggestedProduct()).removeFromSuggestedCustomers((Customer)
currentCustomer());
         //Save to the database.
         EOEditingContext ec =
((Session)session()).defaultEditingContext();
         try { ec.saveChanges();
         } catch (Exception e) {
             NSLog.err.appendln("An exception occurred while trying to
remove a product: " + e);
             ec.revert();
         }
         return null;
     }
.......
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Communication between a URL & a java class
  • Next by Date: using Stored Procedures
  • Previous by thread: Re: Communication between a URL & a java class
  • Next by thread: using Stored Procedures
  • Index(es):
    • Date
    • Thread