Cannot update the record because the version is not the latest

Hi,
I am having the following issue while using update Vertex in multiple threads in java API with blueprints using OrientGraph connection with OrientGraphFactory would you please suggest to me the solution for this

com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDATE the record #390:653 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v25 your=v24)

using 3.0.30 version

Hi @PratikSonawane

the best way to handle this is to catch Concurrent modification exception and retry to operation.

Check here
https://orientdb.com/docs/last/Concurrency.html

Let me know if this helps

Thanks

Also if you are using 3.0.30, i would suggest to use multimodel APIs instead of blueprints one which are kind of deprecated, since they are based on Tinkerpop 2 which is deprecated.

Thanks

hi wolf4ood,
I am using below code snippets is it ok or I have to modify something. ?

public static OrientGraphFactory getOrientGraphFactory() {
	try {
		if (null == factory) {
			//				OrientDBConfigBuilder poolCfg = OrientDBConfig.builder();
			//				poolCfg.addConfig(OGlobalConfiguration.DB_POOL_MIN, 5);
			//				poolCfg.addConfig(OGlobalConfiguration.DB_POOL_MAX, 1000);
			//				OrientDB orientDB = new OrientDB("remote:10.10.10.137", OrientDBConfig.defaultConfig());
			factory = new OrientGraphFactory("remote:10.10.10.137/demodb", "admin", "admin");
			OGlobalConfiguration.DB_POOL_MIN.setValue(5);
			OGlobalConfiguration.DB_POOL_MAX.setValue(1000);
			OGlobalConfiguration.ENVIRONMENT_DUMP_CFG_AT_STARTUP.setValue(true);
			OGlobalConfiguration.CLIENT_CONNECTION_STRATEGY.setValue(OStorageRemote.CONNECTION_STRATEGY.ROUND_ROBIN_CONNECT);
			OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(-1);
			OGlobalConfiguration.COMMAND_CACHE_ENABLED.setValue(true);
			OGlobalConfiguration.dumpConfiguration(System.out);
		}
	} catch (Exception e) {
		log.error("Error in createGraphDb  :: ", e);
	}
	return factory;
}

aslo while create vertex or edge below type of code used.

OrientGraphNoTx orientGraph = orientdb.getNoTx();
OrientVertex vTransaction = orientGraph.addVertex(OrientBaseGraph.CLASS_PREFIX + StringConstants.getMatchOutputTypeApplication());
vTransaction.setProperty(StringConstants.getApplicationId(), appliKey);
orientGraph.commit();