It's all about the answers!

Ask a question

Looking for a method to evict the cache while modify enumerations

Feng Hong (241714) | asked Oct 02 '15, 2:08 a.m.
edited Oct 02 '15, 2:36 a.m. by Ralph Schoon (60.5k33643)
My client attempted to use Java API to modify enumerations, while modify and save a; multiple times with different connections to RTC,  they got

It looks like RTC has 2 instances of the data one in the DB and another one that's cached.  Is there a method to evict the cache, or synchronize these two copies? Also, is there a way to modify enumerations without encountering the StaleDataException(generated by the code below)?

boolean saveProcessArea = false;
final IProcessArea mutableProcessArea = (IProcessArea)
if (!fProcessAreaState.getStateId().equals
(((Auditable)mutableProcessArea).getWorkingCopyPredecessor())) {
         // If the underlying item was changed in other places,
         // we need to indicate the editor is stale.
         throw new StaleDataException(mutableProcessArea, fProcessAreaState);

Any help on answering there will be much appreciated.

One answer

permanent link
Ralph Schoon (60.5k33643) | answered Oct 02 '15, 2:38 a.m.
edited Oct 02 '15, 2:41 a.m.
Consider fetching the object before or after again after modification with a
(not default) . Disconnect and get a new workingcopy manager after saving. See Understanding and Using the RTC Java Client API for some hints. Also see for some working code.

Feng Hong commented Oct 06 '15, 9:01 p.m.

Thank you very much for your response, Ralph. Much appreciated.

Your answer

Register or to post your answer.