Dashboard > WebObjects > ... > Java Client > Java Client - Model-Defined FetchSpecifications
  WebObjects Log In View a printable version of the current page.  
  Java Client - Model-Defined FetchSpecifications
Added by David Avendasora, last edited by David Avendasora on Jan 14, 2008  (view change)
Labels: 
(None)

Client code:

private static final EODistributedObjectStore dos = (EODistributedObjectStore)(EOEditingContext.defaultParentObjectStore());

        /**
	*	Invokes the remote method on session to get a named fetch specification. Needed because
	*	the whole eoaccess package is excluded from the client side frameworks.
	*
		@param	spec	Fetch specification name.
		@param	entity	Name of the entity for which the fetch specification is for.
		@return	The fetch specification, or null if it is not in the model, or an error occured
	*/
	public static EOFetchSpecification getFetchSpecification(
		String spec,
		String entity){
		
		//invoke!
		return (EOFetchSpecification) dos.invokeStatelessRemoteMethodWithKeyPath(
			"session",			
			"clientSideRequestGetFetchSpecification",
			new Class[]{String.class, String.class},
			new String[]{spec, entity});
	}

Server code, in the Session class:

/**
	*	Loads and returns an <tt>EOFetchSpecification</tt> objects for the given
	*	specification and entity name.
	*
		@param	spec	Name of the specification
		@param	entity	Name of the entitiy
		@return	A fetch specification, or <tt>null</tt> if it is not found, or an
			error occurs
	*/
	public EOFetchSpecification getFetchSpecification(String spec, String entity){
		try{
			return EOFetchSpecification.fetchSpecificationNamed(spec, entity);
		}catch(Exception ex){
			return null;
		}
	}

courtesy Florijan Stamenkovic

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators