Re: Further Info : Flattened Many To Many grabbing all objects
Re: Further Info : Flattened Many To Many grabbing all objects
- Subject: Re: Further Info : Flattened Many To Many grabbing all objects
- From: Alexander Spohr <email@hidden>
- Date: Fri, 18 Jan 2008 08:07:40 +0100
The same question every month...
1. never use includeObjectIntoPropertyWithKey if you want to maintain
your object-graph. The otehr side of the relationship will not know
that you changed something.
2. always use addObjectToBothSidesOfRelationshipWithKey as it keeps
everything in sync
3. it is normal behavior because EOF needs to fetch the relationships
objects to have an NSArray into it can add the new object. Not only
for flattened ones.
4. the solution to your problem is to just switch the relationship
OFF. Remove the diamond in EOModeler.
The benefit: still usable for qualifiers, still works for pushing keys
around. But you loose the capability to ask your source objects for
its target objects.
atze
Am 18.01.2008 um 06:24 schrieb Owen McKerrow:
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:
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
Freeport & Soliversum
Alexander Spohr
email@hidden
www.freeport.de
_______________________________________________
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