Mark wrote:
> what is the easiest way to display the sql string that is generated
> on a fetch?  I am trying to examine the sql string so i can optimize
> my query to the oracle database.
>
You can look at all the SQL your application generates by enabling debug for  
 EOAdaptorContext:
In code:
        import com.apple.yellow.eoaccess;
        EOAdaptorContext.setDebugEnabledDefault(true);
        
(If you just want to do this for a specific context you can send the  
instance a setDebugEnabled(true) message.)

>From the commandline:
        defaults write MyWOApp EOAdpatorDebugEnabled YES


If you just want to go right ahead and write your own query, add a custom  
fetch spec for your chosen entity to your model -- the SQL tab at the end  
shows whatever SQL you have "generated graphically" using the panels under  
the other tabs, and also allows you to put in your own SQL (it's easier to  
see this than to explain! -- it should be making its way into a Stepwise  
article in the next day or two).

You can then perform the fetch thus:

        EOModelGroup mg = EOModelGroup.defaultGroup();
        EOEditingContext ec = session().defaultEditingContext();

        EOFetchSpecification fs = mg.fetchSpecificationNamed("directorsOnly",
                                                             "Talent");
        directors = ec.objectsWithFetchSpecification(fs);

Best wishes,

mmalc.

Reply via email to