Hi Stephan,

Have you tied

...
tdoc.save();
tdoc.refreshAndReset();

or

...
tdoc.save();
tdoc.getCmisObject().refresh();

???

TransientDocument knows nothing about the cache and can't invalid it. If the underlying object is in the cache, refresh() should bring it up-to-date.

- Florian



On 01/12/2010 15:54, Klevenz, Stephan wrote:
Hi,

I spend some FIT tests for the transient API. There is one issue I would
like to discuss If I save a transient object and want to read it again
from session then the cached (and unchanged) object is returned. To get
rid of the cached object I have to do effort via operation context (see
my code snipped below).

Can we do an invalidate on the cached object instead so that the session
returns always a new object after save? After save the document1 in my
sample should become invalid, too. To continue with document1 could
throw an illegal state exception or something else.

WDYT?

Regards,
Stephan


TransientDocument tdoc = document1.getTransientDocument();
assertNotNull(tdoc);

[...]

tdoc.save();

ObjectId id = this.session2.createObjectId(tdoc.getId());


// prepare new non-cache operation context
OperationContext oc = this.session.createOperationContext();
oc.setFilterString("*");
oc.setCacheEnabled(false);


Document doc3 = (Document) this.session.getObject(id, oc);
assertNotNull(doc3);
assertEquals(doc3.getProperty(PropertyIds.NAME).getValueAsString(),
newDocName);




Reply via email to