It's not that easy because injection works with Tapestry-handled object
(via annotation or specification).
You need your "visit" state object, and to access a state objet you must
have an access to the "tapestry.state.ApplicationStateManager" service
point. I see to solutions:
1. The simplest: pass your user as a parameter to your "create"
function, or to some kind of «prepareForCommit».
2. My prefered: use HiveMind to provide a DAO that will take the
responsibility of setting the user on the created objet. You'll
have to inject the tapestry.state.ApplicationStateManager
service to this DAO in your hivemodule.xml.
Hivedoc:
http://jakarta.apache.org/tapestry/tapestry/hivedocs/service/tapestry.state.ApplicationStateManager.html
Interface:
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/engine/state/ApplicationStateManager.html
Hope this helps.
Le vendredi 30 décembre 2005 à 13:19 -0700, John Smith a écrit :
> I apologize for just mooching help off this list, but I haven't been able to
> figure this out other places.
>
> For my database layer, I want to always write in the database the username
> of the user that is changing the record. So if I create a new record, I want
> to write who created it (created_by).
>
> The db code I have is several layers removed from tapestry, but the db code
> is managed by hivemind.
>
> I want to inject the Visit object into the db code and then use the Visit
> object to get the username and write that into the "created_by" field of the
> db table.
>
> Tapestry pages can easily just inject application state objects into pages,
> but this is not a page. But I am betting that it is not that hard, if I only
> knew how to do it.
>
> thanks
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]