Re: raw sql, eo and cache

Paul Lynch <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
On 20 Oct 2006, at 09:36, Trond Kandal wrote:

> i am using an oracle database as a datastore.  the database manager  
> want me to call stored procedures to get data. the stored procedure  
> returns a table of data.  the only solution i could find was to use  
> raw sql and pick the data from a NSArray of NSDictionaries.
> i am a bit worried for the performance.  will eo cache the data and/ 
> or do some kind of "lazy fetches?

No.  Raw rows are not cached.  You can, of course, implement your own  
caching of returned data, but then you might just as well be using  
JDBC (ok, it's not quite that bad, but almost).

Digression: raw rows often look like a quick and easy performance  
speed up for novices, as almost a drop in replacement for EOs, but it  
isn't that simple.  Raw rows aren't cached and they can't take  
advantage of prefetching relationships, plus they obviously don't  
have any business logic.  Updates made through raw sql don't  
accumulate in an editing context, either.  For these reasons,  
database access through well chosen EO fetches and editing contexts  
are usually more efficient than raw row access - provided you can  
afford the additional memory overhead of snapshots.

Back on track: However, I think you should be looking at stored  
procedure support in eomodel.  You can define stored procedures to  
fetch/insert/delete/etc behind an entity in your eomodel.  I have  
never used these, but it sounds like it will do what you are looking  
for:

http://developer.apple.com/documentation/WebObjects/UsingEOModeler/ 
index.html

Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.