> Is there any documentation available about usage of
> EnterSitemapEventListener?
OK, maybe it would be helpfull to state the goals I want to achieve.
I read [1] and want/have to implement the OpenSessionInViewFilter/Interceptor
for myself. Unfortunately for me, Robin left no results within his discussion ;)
So my basic idea/workflow is somewhat 'straightforward' (see [2], too):
1. Open Hibernate Session and bind it to the current thread:
Session sess = sessionFactory.openSession();
sess.beginTransaction();
//Bind the Session to the current thread/transaction
TransactionSynchronizationManager.
bindResource(sessionFactory, new SessionHolder(sess));
//Activate transaction synchronization for the current thread.
TransactionSynchronizationManager.initSynchronization();
Springs TransactionSynchronizationManager comes into play directly, because
otherwise calls to getCurrentSession() would throw Exception, because
LocalSessionFactory proxies Hibernate SessionFactory (in short: you have to
tell what current session-context is).
2. render the view
3. commit the Session and close it (unbind it from the current Thread, too.
Code example yould be found at [2])
Hopefully (as Robin stated) this won't breake calls to other sitemaps, but I
would guess it wouldn't. Second idea behind that approach (away from Springs
OSIV) is to use that as codebase to also implement the
long-conversation-pattern and store Hibernates Session inside a users
HttpSession.
And here I am left with no documentation about the Sitemap-Listeners. E.g. is
the HttpSession available, or to be general, wich Objects are available inside
those Listeners? I would think, that SitemapEvent.getEnvironment() would always
return a HttpEnvironment at runtime, right? If so, the session could be
retrieved by
ObjectModelHelper.getRequest(sitemapEvent.getEnvironment().getObjectModel()).getSession()
Still right? This is the only way I've seen so far.
So maybe there is some hidden documentation available for those Listeners, or
comments on what I've tried to explain ;)
Best greetings,
Patrick
--
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games!
http://games.entertainment.gmx.net/de/entertainment/games/free
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]