You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Klevenz, Stephan" <st...@sap.com> on 2010/12/01 16:54:19 UTC
Feedback Transient API
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);
Re: Feedback Transient API
Posted by "Klevenz, Stephan" <st...@sap.com>.
Hi Florian,
I did think into wrong direction. The session.clear() does solve the issue.
Regards,
Stephan
On 01.12.2010, at 17:19, Florian Müller wrote:
> 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);
>>
>>
>>
>
Stephan Klevenz
Development Architect
TD Core UI Infr (AG)
ECM-I
SAP AG
Dietmar-Hopp-Allee 16
69190 Walldorf, Germany
T +49 6227 7-65878
F +49 6227 78-36242
M +49 160 90432408
E stephan.klevenz@sap.com
www.sap.com
Pflichtangaben/Mandatory Disclosure Statements: http://www.sap.com/company/legal/impressum.epx
Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.
This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.
Re: Feedback Transient API
Posted by Florian Müller <fl...@alfresco.com>.
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);
>
>
>