So it seems that it is generally not a good idea to mix SQL updates and Java API object updates in a multi-threaded situation.
If I do a getLocalCache().clear() at every update, any in flight object updates on other threads may be interfered with (not a good idea). Since I know what document I am updating when I run the SQL, I will use the reload() on the one in memory and see if that fixes it. Been testing for an hour and reload() does the trick. Works beautifully! I have been using SQL because it can be saved, replayed and audited in a readable way but I see logic in using the direct API for performance and concurrency, it makes perfect sense that the SQL running on the server would not have any effect on the objects in the local cache. Thanks for your help Luca. Greatly appreciated. Glenn On Sunday, 22 March 2015 05:11:26 UTC-6, Lvc@ wrote: > > Hi Glenn, > You can do reload of specific documents or graph elements (look for > .reload() API on both). > > If you want to clear the cache you can still do that with: > > *db.getLocalCache().clear();* > > and with Graph API: > > *graph.getRawGraph().getLocalCache().clear();* > > NOTE: clearing cache could bring some problems if you have objects not > saved yet: they could be lost. > > Lvc@ > > On 22 March 2015 at 08:03, Glenn Irwin <[email protected] <javascript:> > > wrote: > >> I have a case where I am updating an object/document in OrientDB using a >> SQL statement but my connection is still returning the old version when I >> select it. It appears that the local cache does not know that the SQL >> updated that object. >> >> Is there a way to flush that object from the cache of all the connections? >> >> Or should my code be updated/rewritten to use the direct document API to >> ensure concurrency? >> >> Turning the cache off solved this in the 1.7+ versions but this is >> causing me problems in 2.0 where I cannot turn the cache off. >> >> I am using OrientDB 2.0.5 >> >> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "OrientDB" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
