Ok, I think I get the idea...

But where and when do you set the ThreadLocal? It must be set on every request (each request is another thread...) Do you have a common base class where you handle this? Any other way you do it?

Max


Am 28.07.2009 um 00:08 schrieb Juan E. Maya:

Hey Max, I had a similar problem and at the end create an object in
the ThreadLocal that contains a SecurityContext with the user
information (very lightweight object). The idea was taken from
Spring-Security. This way u have access to the user in the execution
thread. It was kind of weird for me to be accessing the HttpSession in
all the layers of the application.


On Mon, Jul 27, 2009 at 11:18 PM, "Max Weißböck
(info)"<m...@weissboeck.info> wrote:
Sorry, my question seems not to be clear.

It is not a Hibernate question, I now how to acces and set the attributes
using the event.
I already set the creation and modification date in each entity.

But what I need too, is who (which user) did the creation/ modification of an
entity.
This information (the user) is in an SSO (WebUser in my case) but I could
not figure out,
how I can get access to this SSO from the Hibernate Listener Class.

thx, Max

Am 27.07.2009 um 22:42 schrieb Igor Drobiazko:

This is a Hibernate question, not Tapestry. Have a look into the event
passed to your listener.
There is a method called getEntity().

On Mon, Jul 27, 2009 at 10:34 PM, Max Weißböck (info)
<m...@weissboeck.info>wrote:

I'm using Hibernate Listeners PreUpdateEventListener and
PreInsertEventListener to do audit logging in the DB.

Now my problem is, how can I get access in the EventListenr class to the
SSO where the user is stored? As Hibernate loads
the classes as defined in the config file (see below), I can not bind
them
using AppModule and @Inject something - or at least I do not know how.

I searched the list but found no solution (or did not understand it ;-)

Thx, Max

--- definition in hibernate.cfg.xml ---

<!-- Audit Listener -->
<listener type="pre-insert"
class="net.weissboeck.gimmo.entities.AuditListenerImpl"/>
<listener type="pre-update"
class="net.weissboeck.gimmo.entities.AuditListenerImpl"/>






--
Best regards,

Igor Drobiazko


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to