简体   繁体   中英

How to use batching in OrientDB using Java

I am new to OrientDB , and I am wondering how to use batch and massive write/insert in the Java native driver. I couldn't find any examples in Java .

UPDATE

Since I am using Document API , so using the massive insertions is simply

db.declareIntent(new OIntentMassiveInsert());
//your code here....
db.declareIntent(null);

Here's a small example

OrientGraph g=new OrientGraph(yourPath); 

    String cmd = "begin\n";
    cmd += "LET source = SELECT FROM V WHERE id = 'zz'\n";
    cmd += "LET target = SELECT FROM V WHERE id = 'yy'\n";
    cmd += "LET edge = CREATE EDGE RELATION FROM $source TO $target\n";
    cmd += "commit";

g.command(new OCommandScript("sql", cmd)).execute();

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM