For clarification:
DataContext.invalidateObjects(...) What strategy would you use to
invalidate everything?
For .addPrefetch(String s), does s need to match the relation name in
the xml files?
And on a related note...
What does "Max. Number of Shared Objects" actually limit, and what
does the "Use Shared Cache" toggle do?
If I set my "Max. Number of Shared Objects" to zero, or unchecked "Use
Shared Cache" would that force Cayenne to hit the database every time
a query was executed or a relation was fetched?
On Tue, Jun 10, 2008 at 3:03 AM, Andrus Adamchik <andru..bjectstyle.org> wrote:
> To control relationship refresh you can either use
> DataContext.invalidateObjects(..) or plan a bit ahead and refresh it
> together with the query that fetched the root object by using prefetching on
> that relationship. E.g.
>
> someQuery.addPrefetch("relatedRows");
> List rows = context.performQuery(someQuery);
>
> Judging from your example the prefetch option should be exactly what you
> need.
>
> Andrus
>
>
> On Jun 9, 2008, at 11:08 PM, Chris Gamache wrote:
>>
>> Using Cayenne 2.0.3 ...
>>
>> I'm having problems when I use an accessor to get rows from a related
>> table. It pulls fresh data the first time I use the accessor, but if
>> data is modified outside of the Java application, it is not reflected
>> the next time I use the accessor in a different execution stack within
>> the same JVM.
>>
>> List rowsA = context.performQuery(someQuery);
>> ...
>> SomeTable dataSetA = rowA.getRelatedRows();
>> //object rowA and dataSetA and someQuery pass out of scope
>> ...
>> //Data is Modified directly on the database, not in Java application
>> ...
>> List rowsB = context.performQuery(theSameQuery);
>> ...
>> SomeTable expectedModifiedButGotSetA = rowB.getRelatedRows();
>>
>>
>> The primary key which the relation uses to get the related data
>> doesn't change from rowsA to rowsB. We're looking at the same related
>> rowset, just updated data.
>>
>> I would like to know what is the magic no-cache recipe to force that
>> particular accessor to always pull fresh data from the database...
>>
>> It appears that SelectQuery doesn't suffer from the same problem.
>>
>> I'm sure there's some configuration switches that I can trip, but
>> there are several places caching policies can be modified and several
>> confusingly similar yet different options to choose from.
>>
>
>
This archive was generated by hypermail 2.0.0 : Mon Jun 16 2008 - 10:37:09 EDT