Hi,

We do superclass the EOEditingContext according to Chuck's method with his ValidatingEditingContext.

When créating the "new" editing context, we pass our Session.

So it's easy to get the session from a enterprise object : this.editingContext().getSession().


        public Session()
        {
                super();

                setDefaultEditingContext(new ValidatingEditingContext(this));
        }

Jérémy

Le 7 mars 09 à 13:37, Riccardo De Menna a écrit :

Hi folks,

I've encountered this issue (or similar ones) very often now and I'd love to know how others tackle the problem.

I have implemented a standard way of adding a special timestamp to all my records in my TGenericRecord (subclass of EOGenericRecord, superclass of all my eo). The timestamp holds information on when a record was last modified as well as who did it. To do this I need to query my session for something like a "currentUser" method inside the validateTimestamp method of my eo...

Is there a way to climb up to the Session from an EO?

One possible (failed) attempt:

One first clumsy attempt of mine was to override defaultEditingContext() in my Session object and setting the ec delegate object to the session itself before returning it. Then from the eo I would ask for the ec.delegate() and get the session back. Should work in theory, even though I dislike the fact that I use the delegate() that's meant for other things. In practice it doesn't... When I factor in my D2W pages my eo don't have the same ec I passed in at factory creation time and so there's no session there.

Am I blind? Is there a fast an easy way to do it?

rdm
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jeremy.deroyer %40ingencys.net

This email sent to jeremy.dero...@ingencys.net


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to