Further Info : Flattened Many To Many grabbing all objects
Further Info : Flattened Many To Many grabbing all objects
- Subject: Further Info : Flattened Many To Many grabbing all objects
- From: Owen McKerrow <email@hidden>
- Date: Fri, 18 Jan 2008 16:24:33 +1100
Hi All,
I've done some more digging. We recently update our project to use
EOGenerator ( using the standard Template files that come with it )
which as Im sure you all know changes the behavior of adding an
object from a method that looks like this :
public void addToAssociatedWebsiteDisplays
(edu.uow.ris.framework.eo.Publication object) {
includeObjectIntoPropertyWithKey(object,
"associatedWebsiteDisplays");
}
to one that looks like this :
public void addToAssociatedWebsiteDisplaysRelationship
(edu.uow.ris.framework.eo.Group object) {
addObjectToBothSidesOfRelationshipWithKey( object,
"associatedWebsiteDisplays" );
}
which is another place where Im seeing the behavior I described in my
first email. If I change the method back to use
includeObjectIntoPropertyWithKey instead of
addObjectToBothSidesOfRelationshipWithKey the load of all the related
objects goes away. So at this stage it seems (?) to be a better
option. However I have always been told use
addObjectToBothSidesOfRelationshipWithKey its better, it knows how to
handle the relationships and sets the reverse one for you, which is
why I assume the standard EOGeneartor template uses it. But is it
worth it with such a performance hit ? Not only do I have 17,000
objects loaded, it also causes about a 30 second slow down when doing
a save.
Anyways just some late Friday afternoon ramblings. Any and all help
would be most appreciated.
Owen McKerrow
WebMaster, emlab
Ph : +61 02 4221 5517
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
On 18/01/2008, at 2:56 PM, Owen McKerrow wrote:
Hi All,
I have a flattened many to many relationship between two table
Group and Publication, called AssociatedWebsites. Now when I call
thePublication.addObjectToBothSidesOfRelationshipWithKey
(aGroup,"associatedWebsiteDisplays");
or
aGroup.addObjectToBothSidesOfRelationshipWithKey
(thePublication,"associatedWebsiteDisplays");
and watch the SQL it its loading all of the objects currently
related between the two. ie. whe I have SQL debugging turned on I
see the following SQL straight after either of the previous lines
of code ( I of course put in the ... etc etc ) :
14:40:27,552 DEBUG [WorkerThread7] (Log.NSLogDebug:1546 appendln)
- === Begin Internal Transaction
14:40:27,553 DEBUG [WorkerThread7] (Log.NSLogDebug:1546 appendln)
- evaluateExpression: <com.webobjects.jdbcadaptor.OraclePlugIn
$OracleExpression: "SELECT t0.category_for_other, t0.chapter_title,
etc etc .... FROM PUB t0, ASS_WEB_DISP T1, GRP T2 WHERE T2.grp = ?
AND t0.pub = T1.pub AND T1.grp = T2.grp" withBindings: 1:30(groupID)>
14:40:34,648 DEBUG [WorkerThread7] (Log.NSLogDebug:1546 appendln)
- 17481 row(s) processed
14:40:34,650 DEBUG [WorkerThread7] (Log.NSLogDebug:1546 appendln)
- === Commit Internal Transaction
Is this standard behaviour for flattened relationships ? Is there
any way to stop this from happening ? Do I need to model the
relationships differently ? I don't want to have to load all 17,000
just to add an extra one.
Thanks
Owen McKerrow
WebMaster, emlab
Ph : +61 02 4221 5517
http://emlab.uow.edu.au
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
"As of tomorrow, employees will only be able to access the building
using individual security cards. Pictures will be taken next
Wednesday employees will receive their cards in two weeks."
- "Dilbert Quotes" Winner, Fred Dales, Microsoft Corp
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40uow.edu.au
This email sent to email@hidden
_______________________________________________
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