• 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
EO Caching with global id 'fetching'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EO Caching with global id 'fetching'


  • Subject: EO Caching with global id 'fetching'
  • From: Jonathan Ricker <email@hidden>
  • Date: Wed, 15 Oct 2008 15:17:23 -0400

Hey All,

Heres my basic scenario.  Ive got an entity called a CARule entity.  For some of these rules the value attribute contains a department number which should equal the primary key value of a related entity called CADept (which is read-only entity).  So I created this method in the CARule.java class to get the CADept related object (if there is one).  It works fine, but the problem is that the value is not cached.. I log out the sql and it is fetching nearly every time for the same editing context.  What am I missing?  I thought it would essentially fetch once and be cached thereafter.  It is all in a standard ERXEC editing context without any special settings.

/**
* A method to get the CADept object related to this rule.  It will 
* return null unless it is the appropriate type of role
*/
public CADept dept(){
CADept dept = null;
if (isDeptLeafRule()){
EOGlobalID gid = EOKeyGlobalID.globalIDWithEntityName(
CADept.ENTITY_NAME, new String[]{value()});
System.out.println("Fetching " + value() + " in ec " + editingContext());
dept = (CADept)editingContext().objectForGlobalID(gid);

if ( dept == null){
//dept = (CADept)ERXEOGlobalIDUtilities.fetchObjectWithGlobalID(editingContext(), gid);
// I tried the above as well and still didn't get the caching I wanted.
dept = (CADept)editingContext().faultForGlobalID(gid, editingContext());
// Could be a bad rule if the value does not equal to a know dept number
// trigger the fault here and catch it.
try{
System.out.println("Triggering "+value()+" in ec: " + editingContext());
dept.deptName();
}catch (ObjectNotAvailableException e){
log.error("Rule has dept value of " + value() 
+ " which is not in common_dept!", e);
dept = null;
}
}else{
System.out.println("Got the dept " + value() + " directly");
}

}
return dept;
}



Thanks in advance for any help on this (particularly on my understanding of caching, I know I can do some workarounds to make the app more efficient but I'm trying to avoid my tendency to do that here)

-- Jonathan


 _______________________________________________
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

  • Follow-Ups:
    • Re: EO Caching with global id 'fetching'
      • From: Jonathan Ricker <email@hidden>
  • Prev by Date: Debugging ERJavaMail
  • Next by Date: Re: ERXWOForm API ?
  • Previous by thread: Debugging ERJavaMail
  • Next by thread: Re: EO Caching with global id 'fetching'
  • Index(es):
    • Date
    • Thread