0

これはDatastax DSE 5.0グラフのグラフ操作をコミットしてロールバックする方法は?

Exception in thread "main" java.lang.UnsupportedOperationException: Graph does not support transactions 
00:27:52.420 [cluster1-nio-worker-0] DEBUG io.netty.buffer.PoolThreadCache - Freed 26 thread-local buffer(s) from thread: cluster1-nio-worker-0 
    at org.apache.tinkerpop.gremlin.structure.Graph$Exceptions.transactionsNotSupported(Graph.java:1127) 
    at org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph.tx(EmptyGraph.java:75) 
    at org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.tx(GraphTraversalSource.java:320) 
    at testbed.TestBed.main(TestBed.java:28) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:497) 
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) 

「グラフは、トランザクションをサポートしていません」それはDatastaxに買収される前にTitanDBで許可されますが、私は取得して以来、私は私が何かを見つけることができませんでした

DseCluster dseCluster = null; 

    try { 
     dseCluster = DseCluster.builder() 
       .addContactPoint("192.168.1.43") 
       .build(); 
     DseSession dseSession = dseCluster.connect(); 
     GraphTraversalSource g = DseGraph.traversal(dseSession, new GraphOptions().setGraphName("graph")); 
     GraphStatement graphStatement = DseGraph.statementFromTraversal(g.addV("test")); 
     GraphResultSet grs = dseSession.executeGraph(graphStatement.setGraphName("graph")); 
     System.out.println(grs.one().asVertex()); 

     g.tx().commit(); 

    } finally { 
     if (dseCluster != null) dseCluster.close(); 
    } 

を実行しようとしましたDatastax DSEグラフをトランザクションと言います。

ありがとうございます!

答えて

2

Michay、Andyが答えた他の投稿で、DSEが現時点でどのように取引を行っているかについていくつかの洞察を示しました。私たちはTinkerpopトランザクションAPIを直接エンドユーザーに公開しません。トランザクションは現在暗黙的に実行されており、各executestatementコールはDSEグラフサーバ内のTinkerpopトランザクションメカニズムを起動します。ここでは、トランザクションがDSEグラフとどのように連携するかを示すGitHubの簡単な例を示します - https://github.com/jlacefie/GraphTransactionExample

+0

いくつかの文脈では、http://stackoverflow.com/a/41232259/986160 @jilacefieありがとう!私はまた、このトランザクションが1つのトランザクションを占めているのだろうか(executeGraph()によって行われなかった場合): '' 'Vertex v = g.addV(" User ")。 ''それは実際にその時点までのすべてを格納するので、それはトランザクション権利なのでしょうか?.. v.property( "someotherprop"、 "testprop")を実行すると別のトランザクションですか?もう一度ありがとうといい仕事をしてください:) –

+0

実際に私は上記のことを試してみたところ、 '' 'java.lang.IllegalStateException:プロパティの追加はサポートされていません' ''私は頂点を.next() –

+1

Michail、ここのベータ版のdoc:https://github.com/datastax/java-dse-graph/tree/1.0.0-beta1/manualこれはまだサポートしていないようです新しいFluent APIを使用した変異。文字列渡しの仕組みは今のところ行く方法です。私はドライバーチームメンバーの一人にこの記事をレビューし、必要に応じて修正するよう依頼しました。フィードバックbtwありがとうございます。より直接的なやりとりのためにdatastaxアカデミーのグラフスラックルームに参加してください。 – jlacefie

関連する問題