我正在使用 Orientdb 2.2.12 。
我想将自动增量属性设置为顶点
例如
for(i 1 to 100)
{
vertex.setProperty("counter", AUTO_INCREMENT_Value(start = 0))
}
我试图通过创建序列
来实现这一目标sequenceLibrary.createSequence(AUTO_INCREMENT_Value, SEQUENCE_TYPE.ORDERED, new OSequence.CreateParams().setStart((long) 0));
for(int i=1 ; i<=100; i++)
{
vertex.setProperty("counter", AUTO_INCREMENT_Value);
graph.commit();
graph.shutdown();
}
虽然它在单线程系统中运行良好,但在多线程系统中会产生模糊结果。
我给每个线程一个来自OrientGraphfactory的单独的OrientGraph实例,正如官方文档中所述:
OrientGraphFactory graphFactory = new OrientGraphFactory(
"remote:" + IP + ":" + PORT+ "/" + appName).setPool(1, 100);
OrientGraph graph = graphFactory.getTx();
有没有办法在orientdb中实现这个目的。
谢谢..!