chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Klevenz, Stephan" <stephan.klev...@sap.com>
Subject Feedback Transient API
Date Wed, 01 Dec 2010 15:54:19 GMT
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);




Mime
View raw message