cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lawrence Gerstley <lawg...@rcn.com>
Subject Re: Lifecycle Design
Date Thu, 09 Apr 2009 23:34:12 GMT
So, I have the same question here--multiple thick clients (desktop RCP  
applications), each with a DataContext tied to the same backend, and  
potential database access (direct or otherwise) from other toolsets  
out of my control. Is there a recommended strategy for refreshing each  
applications singleton DataContext to stay in synch, or manually a  
supplying refresh command to the DataContext to periodically update  
(and, if so, with what/how)?

Kind regards,

Lawrence
===================================
Lawrence Gerstley, Ph.D.
PSMI Consulting
lawgers@gmail.com
Cel: (415) 694-0844

On Apr 8, 2009, at 4:22 PM, Malcolm Edgar wrote:

> Hi Joe,
>
> Your singleton cache is going to need to be update periodically if
> there are changes to the under lying database from other sources.
>
> regards Malcolm Edgar
>
> On Thu, Apr 9, 2009 at 7:45 AM, Joe Baldwin  
> <jfbaldwin@earthlink.net> wrote:
>> I *think* this is a life-cycle question, but there may be more to it.
>>
>> Proposed Design:
>>
>> 1. Standard Web page JSP using Tomcat server.
>> 2. One of the JSP's accesses a singleton.
>> 3. The singleton accesses and stores a database field via Cayenne
>> (presumably when the class is initially loaded) and should never  
>> need to
>> access the field again.
>> 4. I would prefer it if the database field change would be  
>> propagated to the
>> singleton upon the next new client-Session.
>>
>> Problem
>> 1. Here is the odd bit: the database field can be modified via  
>> direct access
>> to the database (SQL, etc).
>> 2. Cayenne appears not to see this change even when a new client- 
>> Session is
>> initialized.
>> 3. I can *force* the singleton to recognize the change by  
>> restarting Tomcat
>> (but that is totally lame :) )
>> 4. Unless I have made a mistake (which is possible), the singleton  
>> should be
>> only associated with JSP session scope.  But if I am wrong, this  
>> could be
>> the problem.
>>
>> Obviously, I have a misunderstanding about either Cayenne or Tomcat  
>> caching
>> or perhaps its a combo of the two.  It appears from my tests that the
>> singleton class may be constructed the first time after Tomcat is  
>> restarted
>> and then remains persistent even across different sessions.
>>
>> Are there any suggestions as to a simple design in which my  
>> singleton forces
>> re-initialized (i.e. refresh the Cayenne object from the DBMS data)  
>> upon
>> each new session?
>>
>> Thanks,
>> Joe
>>
>>
>>
>>


Mime
View raw message