[prev in list] [next in list] [prev in thread] [next in thread]
List: struts-user
Subject: Re: Hibernate data at startup
From: Joe Germuska <Joe () Germuska ! com>
Date: 2005-09-30 12:34:34
Message-ID: a0621020ebf62dffa19dd () [192 ! 168 ! 1 ! 101]
[Download RAW message or body]
Note that if you are running in a clustered environment (or want to
be ready to move to one without rewriting your application) this is
not a good solution. The ServletContext is specifically not to be
shared amongst clustered interests according to the specifications.
This is particularly a problem if the data will ever be modified in
the application; if you really are reading it from the database but
only changing the database between application restarts, you could
probably get away with it.
Hibernate offers a flexible second-level cache which can provide the
kind of insulation against repeated trips to the database. (see
http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#performance-cache)
If you really aren't using the database to update your menu, i'd
suggest just making it a Spring bean and populating it in XML; if you
implement the ServletContextAware and InitializingBean interfaces,
you can even have your bean put itself into the ServletContext at
initialization time.
Joe
At 12:12 AM -0500 9/30/05, Nick Heudecker wrote:
>You have a few options. To initialize Spring, you can either use the Struts
>plugin or the web app context listener. Once that's done you can either use
>a startup servlet or a Struts plugin to load the data and put it into the
>servlet context. That way it only needs to be loaded once and is shared
>throughout the application.
>
>It's pretty simple, but not very obvious.
>
>
>On 9/30/05, Martin Ravell <martin.ravell@fmsglobal.com> wrote:
>>
>> I have Menu information for my app in the database which I would like to
>> be
>> able to load somehow when my app server starts up (or app is deployed).
>> This
>> would be much more efficient than the current method of having each user
>> load it when they enter the application.
>>
>> Can anyone suggest how to best go about doing this? The architecture is
>> Struts, Hibernate and Spring.
>>
>>
>> Thanks
>> Marty
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic