• 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
Re: How to avoid expensive fetches in database when setting to-one-relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to avoid expensive fetches in database when setting to-one-relationship


  • Subject: Re: How to avoid expensive fetches in database when setting to-one-relationship
  • From: Chuck Hill <email@hidden>
  • Date: Sun, 05 Jun 2016 22:22:41 +0000
  • Thread-topic: How to avoid expensive fetches in database when setting to-one-relationship

You can do that, but the generated method won’t work as they depend on it being a class property.  You can rewrite them to do fetches

 

From: Jérémy DE ROYER <email@hidden>
Date: Sunday, June 5, 2016 at 2:03 PM
To: Jérémy DE ROYER <email@hidden>

Cc: Chuck Hill <email@hidden>, WebObjects-Dev <email@hidden>
Subject: Re: How to avoid expensive fetches in database when setting to-one-relationship

 

Maybe removeRelationship(EORelationship relationship) from EOEntity ?

 

Jérémy DE ROYER

 

Le 5 juin 2016 à 22:57, Jérémy DE ROYER <email@hidden> a écrit :

 

My first tests with your solution work great !

 

Is it possible to remove the class property programmaticaly in order to keep the generated .eogen (and all the associated methods) up and running ?

 

Or maybe another « practical » solution better than re-add the properties before generating the .eogen and our associated .class and then removing the properties.

 

Jérémy

 

Le 5 juin 2016 à 22:04, Chuck Hill <email@hidden> a écrit :

 

Remove the “class property” setting for the ModeTransport to Order.  You can still use it for fetching.

 

Chuck

 

 

From: <webobjects-dev-bounces+chill=email@hidden> on behalf of Jérémy DE ROYER <email@hidden>
Date: Sunday, June 5, 2016 at 12:55 PM
To: WebObjects-Dev <email@hidden>
Subject: How to avoid expensive fetches in database when setting to-one-relationship

 

Dear all, 

 

In our app, we have a one to many relationship between order and mode transport

 

For each order, we set the mode transport using the method below :

 

 

  public void setModeTransportRelationship(ModeTransport value) {

    if (_CommandeClient.LOG.isDebugEnabled()) {

      _CommandeClient.LOG.debug("updating modeTransport from " + modeTransport() + " to " + value);

    }

    if (value == null) {

    ModeTransport oldValue = modeTransport();

    if (oldValue != null) {

    removeObjectFromBothSidesOfRelationshipWithKey(oldValue, "modeTransport");

      }

    } else {

    addObjectToBothSidesOfRelationshipWithKey(value, "modeTransport");

    }

  }

 

 

Then, an objectWillChange() is fired for the mode transport… but the (not wished) consequence is that every to many relationships from the mode transport are fetched (even if we don’t call the associated method for the mode transport). However, the objects associated with the to one relationships are not fetched.

 

We observed the same behavior for the customer object when using the setCustomerRelationship method of the ordre. The (bigger) problem is that the customer object has dozen of to many relationships... fetched for nothing…

 

At the beginning we had few orders but now, we have to wait from 10 to 30 seconds until de saveChange is ended and that’s really not effective. More than 90 % of this time is spent for fetching the to many relationship whereas we just had to save the order values...

 

Any idea how to deal with theses not-wished-fetches ?

 

Jérémy

 

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How to avoid expensive fetches in database when setting to-one-relationship (From: Jérémy DE ROYER <email@hidden>)
 >Re: How to avoid expensive fetches in database when setting to-one-relationship (From: Chuck Hill <email@hidden>)
 >Re: How to avoid expensive fetches in database when setting to-one-relationship (From: Jérémy DE ROYER <email@hidden>)
 >Re: How to avoid expensive fetches in database when setting to-one-relationship (From: Jérémy DE ROYER <email@hidden>)

  • Prev by Date: Re: How to avoid expensive fetches in database when setting to-one-relationship
  • Next by Date: Re: How to avoid expensive fetches in database when setting to-one-relationship
  • Previous by thread: Re: How to avoid expensive fetches in database when setting to-one-relationship
  • Next by thread: Re: How to avoid expensive fetches in database when setting to-one-relationship
  • Index(es):
    • Date
    • Thread