• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
EOF being overly helpful.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EOF being overly helpful.


  • Subject: EOF being overly helpful.
  • From: Owen McKerrow <email@hidden>
  • Date: Tue, 20 Sep 2005 11:30:10 +1000

Hi All,

I have a table called Person which has a to-many relationship with a table PersonName, which is an optional relationship and Own's Desition is ticked and has a Batch Fault of 5.
The inverse relationship from PersonName to Person is to-one and mandatory. PersonName has its own primary key.
The idea here being a Person's name may change over time and this way I can track when that happens and any records which they entered before the name changed will still have the old name associated with it.
I have a fetch spec in PersonName which I use to get a list names of members which are currently active.
The fetch spec is :
active = 1 and person.accessLevel <> -1 and ( person.type = 2 or person.type = 3 )


Where active indicates its a currently active name, person.accessLevel <> -1 indicates the person is not inactive and person.type 2 & 3 indicates I only want the staff and students.

selectablePersons = (NSMutableArray) EOUtilities.objectsWithFetchSpecificationAndBindings (ec,"PersonName","getActiveMembers",null);

Now this works fine, it retrives all the records I want in 1 hit.
And produces the following SQL

[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT DISTINCT t0.active, t0.creationDate, t0.firstName, t0.initial, t0.lastName, t0.personID, t0._rowid FROM PERSON_NAME t0, PERSON T1 WHERE (t0.active = ? AND T1.accessLevel <> ? AND (T1.type = ? OR T1.type = ?)) AND t0.personID = T1._rowid ORDER BY t0.lastName ASC, t0.firstName ASC" withBindings: 1:1(active), 2:-1(accessLevel), 3:2(type), 4:3(type)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 167 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction


Not 167 records processed.
However it then grabs all 167 people objects associated with these names, 1 AT A TIME ! Well at least thats what I think its doing. Heres a selection of the SQL that it produces. This is all from the single line of code above.


[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.countryID, t0.email, t0.fileName, t0.filePath, t0.hasFile, t0.institution, t0.onPayroll, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:4(type), 2:1332(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:3(type), 2:1332(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.casualPermant, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:2(type), 2:1332(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> fetch canceled
[2005-09-20 11:20:04 EST] <WorkerThread3> 1 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.countryID, t0.email, t0.fileName, t0.filePath, t0.hasFile, t0.institution, t0.onPayroll, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:4(type), 2:980(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:3(type), 2:980(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.casualPermant, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:2(type), 2:980(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> fetch canceled
[2005-09-20 11:20:04 EST] <WorkerThread3> 1 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.countryID, t0.email, t0.fileName, t0.filePath, t0.hasFile, t0.institution, t0.onPayroll, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:4(type), 2:999(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:3(type), 2:999(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.casualPermant, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:2(type), 2:999(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> fetch canceled
[2005-09-20 11:20:04 EST] <WorkerThread3> 1 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction


Notice how some request produce 0 rows processed and for those that have 1 row processed the fetch is canceled. Suffice to say this is all cause a very large waste of time which means my page takes 4 seconds to load.

I thought perhaps if the to-one relationship between PersonName and Person was optional instead of mandatory it wouldn't try and grab the People records but it still did.

So what am I doing wrong ? I understand EOF is trying to be helpful and grab the People objects for me but this time I don't want it to. In fact Im not even sure what's causing these faults to be fired. If I can't "turn it off" is there any way I can get it to do it all in one go instead of object by object. And why does it cancel the fetch when it actual gets a result ?

As always comments and suggestions welcome.

Owen McKerrow
WebMaster, emlab
http://emlab.uow.edu.au

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

People who prefer typing to pointing then seem to prefer acronyms to save typing :-)
-Denis Stanton, On people using Command Line Interfaces



_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: EOF being overly helpful.
      • From: Chuck Hill <email@hidden>
    • Re: EOF being overly helpful.
      • From: Art Isbell <email@hidden>
  • Prev by Date: Re: D2JC WebObjects is AMAZING!
  • Next by Date: Re: EOF being overly helpful.
  • Previous by thread: Re: D2JC WebObjects is AMAZING!
  • Next by thread: Re: EOF being overly helpful.
  • Index(es):
    • Date
    • Thread