Session.java Addition

Version 4.1 by Francis Labrie on 2008/03/06 11:23

These additions are based on a more advanced Stateless RMI concept by Florijan Stamenkovic.


public EOFetchSpecification clientSideRequestGetFetchSpecification(String fetchSpecification, String entity) {
return getFetchSpecification(fetchSpecification, entity);
}

public EOFetchSpecification getFetchSpecification(String fetchSpecification, String entity){
try{
return EOFetchSpecification.fetchSpecificationNamed(fetchSpecification, entity);
}catch(Exception ex){
NSLog.out.appendln(ex);
return null;
}
}
Warning
Caution

Due to security concerns you cannot call FetchSpecifications from the client-side that use a Raw SQL Expression without implementing the delegate method [distributionContextShouldFetchObjectsWithFetchSpecification|http://developer.apple.com/documentation/MacOSXServer/Reference/WO54_Reference/com/webobjects/eodistribution/EODistributionContext.Delegate.html] which this code does NOT do.

If you try to, you will get the following exception in the server log:

{color:red}Server exception: The fetchSpecification YourFetchSpecificationWithRawSQLExpression was not allowed to execute on the server.  If your application needs to execute this method, the security needs to be relaxed by implementing the delegate method distributionContextShouldFetchObjectsWithFetchSpecification{color}

and this code will return null to the client instead of the expected FetchSpecification.