Perhaps you are misinterpreting what Veogen does? It is all template based, you can make it generate whatever you want.

See 
http://wiki.objectstyle.org/confluence/display/WOL/EOGenerator+Templates+and+Additions

Chuck


On Oct 26, 2008, at 7:25 AM, Jeff Schmitz wrote:

Hello,
I'd like to be able programatically set the setRefreshesRefetchedObjects on specific fetch specifications to true under certain, "run-time" situations to assure I have fresh data from the database when a fetch is performed.

Using the EOGenerator generated "fetch" functions, the Fetch specs are always local to the generated operations, so I'm thinking the only way to do what I need would be to copy a "set" of fetch operations from the generated EO code and change it accordingly in my edited EOCode as shown below. Is there a simpler way to do this that I'm missing? Is there a way to get EOGenerator to produce such functions?


Copied from _Entry.java, pasted into Entry.java and edited to add call to setRefreshesRefetchedObjects:

public static NSArray<Entry> fetchRefreshedEntries(EOEditingContext editingContext, EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) { EOFetchSpecification fetchSpec = new EOFetchSpecification(_Entry.ENTITY_NAME, qualifier, sortOrderings);
  fetchSpec. setRefreshesRefetchedObjects(true);
   fetchSpec.setIsDeep(true);
NSArray<Entry> eoObjects = (NSArray <Entry>)editingContext.objectsWithFetchSpecification(fetchSpec);
   return eoObjects;
 }

public static Entry fetchRefreshedEntry(EOEditingContext editingContext, String keyName, Object value) { return _Entry.fetchRefreshedEntry(editingContext, new EOKeyValueQualifier(keyName, EOQualifier.QualifierOperatorEqual, value));
 }

public static Entry fetchRefreshedEntry(EOEditingContext editingContext, EOQualifier qualifier) { NSArray<Entry> eoObjects = _Entry.fetchRefreshedEntries(editingContext, qualifier, null);
   Entry eoObject;
   int count = eoObjects.count();
   if (count == 0) {
     eoObject = null;
   }
   else if (count == 1) {
     eoObject = (Entry)eoObjects.objectAtIndex(0);
   }
   else {
throw new IllegalStateException("There was more than one Entry that matched the qualifier '" + qualifier + "'.");
   }
   return eoObject;
 }

thanks,
Jeff
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to [EMAIL PROTECTED]


--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to