• 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
Re: Getting information on updated n:m relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting information on updated n:m relationship


  • Subject: Re: Getting information on updated n:m relationship
  • From: Mike Schrag <email@hidden>
  • Date: Fri, 9 Mar 2007 14:17:01 -0500

Yes ... They are a pain. I recently had to fight this part of EOF to get notifications of to-many changes for multicast notification. If you're talking actually getting updates when the to-many snapshot cache updates, here's a stack trace from that happening:

java.lang.RuntimeException
at er.extensions.ERXDatabase.recordSnapshotForSourceGlobalID (ERXDatabase.java:104)
at com.webobjects.eoaccess.EODatabase.recordToManySnapshots (EODatabase.java:755)
at er.extensions.ERXDatabase.recordToManySnapshots(ERXDatabase.java: 200)
at com.webobjects.eoaccess.EODatabaseContext._commitTransaction (EODatabaseContext.java:2199)
at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.webobjects.foundation.NSSelector._safeInvokeMethod (NSSelector.java:120)
at com.webobjects.foundation.NSNotificationCenter$_Entry.invokeMethod (NSNotificationCenter.java:601)
at com.webobjects.foundation.NSNotificationCenter.postNotification (NSNotificationCenter.java:545)
at com.webobjects.foundation.NSNotificationCenter.postNotification (NSNotificationCenter.java:559)
at com.webobjects.eoaccess.EOAdaptorContext.transactionDidCommit (EOAdaptorContext.java:484)
at er.extensions.ERXJDBCAdaptor$Context.transactionDidCommit (ERXJDBCAdaptor.java:220)
at com.webobjects.jdbcadaptor.JDBCContext.commitTransaction (JDBCContext.java:422)
at com.webobjects.eoaccess.EODatabaseContext.commitChanges (EODatabaseContext.java:6471)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingCo ntext(EOObjectStoreCoordinator.java:425)
at com.webobjects.eocontrol.EOEditingContext.saveChanges (EOEditingContext.java:3226)
at er.extensions.ERXEC._saveChanges(ERXEC.java:947)
at er.extensions.ERXEC.saveChanges(ERXEC.java:870)


It turns out that this is one of the few places in EOF where there just is no hook to get to it cleanly. In Wonder, we extend EODatabaseContext and EODatabase to be able to watch for changes to the cache.

Adding in hooks into your EOGenerator classes will probably go pretty far for you. There will be cases that you will not be able to catch at that level -- like something invalidating the to-many cache so a refetch occurs, which finds new members, or refreshes that members are gone, but most NORMAL things, I think you'll "hear".

If you use Wonder, you potentially can hang off of the stuff that already happens in there, but you have to be a little careful, because you're transactionally in a weird place when the snapshot cache is updating.

ms

Yeah, the page is the wrong place to do this. To many relationships are kind of a pain for things like this. I think this happens during processRecentChanges(). It's been a while and I am kind of foggy. Maybe Mike remembers?

I'd also consider two other options. One is to alter the EOGenerator templates so these actions are tracked directly in addTo... and removeFrom... methods on the EOs. The other option is to use something like the CooperatingEditingContext and put the audit code in willSave() on the EO. Either one is probably going to be less painful than poking about in EOF internals and both are way better than UI based tracking.




_______________________________________________
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: Getting information on updated n:m relationship
      • From: Guido Neitzer <email@hidden>
References: 
 >Getting information on updated n:m relationship (From: Guido Neitzer <email@hidden>)
 >Re: Getting information on updated n:m relationship (From: Chuck Hill <email@hidden>)
 >Re: Getting information on updated n:m relationship (From: Guido Neitzer <email@hidden>)
 >Re: Getting information on updated n:m relationship (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Getting information on updated n:m relationship
  • Next by Date: Re: Xcode + WO book
  • Previous by thread: Re: Getting information on updated n:m relationship
  • Next by thread: Re: Getting information on updated n:m relationship
  • Index(es):
    • Date
    • Thread