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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to