it is necessary in order to keep the user settings up to date with respect to the database that may change.
but what could be improved here is to lookup the user according to its primary key and not user name, with that ID hibernate is capable to lookup users directly in the second level cache which avoid to going to the database on each request.
the first time the user is accessed, we retrieve the user and put its ID in the session. on other access we use the user ID to get the user from the session by using a session.get() instead of performing a query.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3886385#3886385
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3886385
|