You could use a read-timeout of 0 with the read-mostly pattern and invalidate the caches programmatically. I'm making the assumption here that when the 'other tool' changes the data in the DB, it can notify/trigger your application.
If you're not using WebLogic, you could have a look at the Seppuku Pattern (http://www.theserverside.com/patterns/thread.jsp?thread_id=11280). ---- Peter Verkestf Marco Mistroni <[EMAIL PROTECTED]>@JAVA.SUN.COM> on 05/09/2002 14:53:56 Please respond to [EMAIL PROTECTED] Sent by: A mailing list for Enterprise JavaBeans development <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] cc: Subject: Re: Question on Entity/Session EJB Hi Hardy, >It sounds to me, as if they tried to implement the Weblogic 'read-mostly' >pattern: >http://www.weblogic.com/docs51/classdocs/API_ejb/EJB_environment.html#1075932 >If not, it may be a solution anyway. thanx 4 the suggestion, but it may not be completed for me... problem is that i have to manage users from different countries. each country has a predefined set of services available, so all the users that logs in from the same country should have all the same services available. Now every some time the availability of those services change, because some changes are made in the database using another tool. It is not practical, as i said, to cache all the services in HttpSession, since i will have still to call the bean 1 time for every user that logs in. I have read the pattern that u mentioned me, but the issue is that i have to specify a read-timeout, and neither this is pratical: i have to have control over the time in which the bean data is refreshed, 'coz it may happens that one day the database is changed every hours, and some days it is changed 1 time per day, so i cannot set a fixed timeout: - if i set it once per day and the change is done in the afternoon, i have to wait the next day to see changes (which is not acceptable) - if i set it once per hour, it can be a waste of time in days in which the database data never changes. do u have any alternative solutions to suggest me? i was thinking about a Stateful Session bean that is used for updating and reading data... but i am not sure if it will work. Do u have any other suggestion to give me? thanx in advance and regards marco Yes, it is possible to save even more by further caching data in httpSession or in Context (common to all users). Of course it depends on amount of data, how many users requesting the same data, how many times a user request the same data in a session, is web-tier and ejb-tier on the same physical server. kind regards Hardy On Monday 19 August 2002 03:35 pm, Marco Mistroni wrote: > Hi all, > i have a question for you EJB gurus. > I am working on an web-based application for managing personnel's data such > as bank details, salary info, employee's personal data (address ecc). the > main application consists of different services that are visible to > employees depending on their countries (for example, in england all the > abovementioned, in finland only employee personal data ecc..). > > The 'services' available for each country are stored in a database. > > The previous consultants that did the job followed this way of thinking: > since all the employees from finland that will login to the application > will have exactly the same services available, they write an Entity bean > that behaves like an Entity bean but it is not an entity bean(no wonder, > they declared it as 'EntityBean', this is true!): instead of synchronizing > the so called 'Entity bean' with the database, they write it like just a > container of data (it never reads from db). When the database is updated, > another application will lookup the entity bean, and will update the data > contained in the bean. Obviously this never works, and every time there is > a change in the database, we must restart the servers (and they did not > think that time that the changes are on a daily frequence). > > Now, in my opinion the EJB should have been implemented as a SLSB, and for > each user the data retrieved should have been cached in the HttpSession > (for avoiding multiple calls during the application). > > But i am still left with one problem: if each english employee logs in to > the application, it will have always the same services available, so a call > to the SLSB will return exactly the same data for each english employee. > > I can do a bulk load of all the data for 'english' employees thru a SLSB > and then store it into a static class, and solve the updates problem by > using another application that runs in the same JVM to update the data in > the static class....but at this point i start to get confused.... > > > can anyone give me an advice on how to proceed? > > thanx and regards > marco > > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff EJB-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". -- Hardy Henneberg Konsulentfirmaet HHenneberg Gr�nnevej 44 2830 Virum Danmark tel: (45) 26124565 http://www.hhenne.dk =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =====================================To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". ==========================================================================To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
