Hi Derek,
I think all your Ideas are not the right way ...
I would prefer do use my own DataObject-Class derived from CayenneDataObject
for all my Business-Objects.
There you can override the validate* methods, which are called when
an DataObject is commited by the DataContext ...
So you have one class to handle the user-information for
all your DataObjects.
You can config the base class for the
Class generating process in the modeler.
Have a lot of fun ...
--- Juergen ----
"Derek Rendall" <cayenn..sure.com> schrieb am 05.12.04 23:03:09:
>
> Hi
>
> I have a database where each table has a field that stores the user who last
> updated the record. In our current apps we pass around an object that
> contains the user information and set the field in the objects as part of
> the save process. I would prefer it if I could hide and aoutomate this. I
> can see several possible ways of handling this, but am not sure which is the
> most appropriate.
>
> (1) Create a subclass of DataContext which can store User Info. I could
> create this via my own factory method, pass it the user details. Then in a
> superclass of all my objects I could override validateForSave and grab the
> user information from my data context and set it as appropriate. After
> having a look at DataContext I'm not sure that this is a "stable" approach
> (for one thing, the EventSubject instances are final and use the DataContext
> class). Adding a map of "constant" information to the Data Context might be
> a nice addition?
>
> (2) I would love it if the Delegate helped me out, but it doesnt seem to
> have an entry that matches where I want to "interrupt" the process.
>
> (3) Using the DataContext events - WILL_COMMIT in particular. However, the
> quote from an entry in the lists "Re: EventSubjects" dated Wed Jul 21
> 2004 - 16:13:34 has the following comment by Andrus that makes me nervous
> that this approach is a "second class citizen":
>
> " Another place is DataContext events. I wasn't a big fan of it when this
> was originally submitted, now and seems more useful to me (still I am
> looking to redesign this some more in the future :-))... "
>
> Any advice or clarification would be most appreciated.
>
> Thanks
>
> Derek
>
__________________________________________________________
Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201
This archive was generated by hypermail 2.0.0 : Mon Dec 06 2004 - 03:26:18 EST