Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

rohansurana2810_190538 avatar image
rohansurana2810_190538 asked ·

Graph transactions tx() returns UnsupportedOperationException in DSE 6.8

I was trying to use the transaction on DSE 6.8. When I tried to open the transaction it gave me the following error.

Code:

DseCluster dseCluster = DseCluster.builder().addContactPoint("127.0.0.1").build();
DseSession dseSession = dseCluster.connect();
GraphTraversalSource g = DseGraph.traversal(dseSession, new GraphOptions().setGraphName("test_graph"));
g.tx().open();

The error:

Exception in thread "main" java.lang.UnsupportedOperationException: Graph does not support transactions

What is the possible fix for this?

dsegraph
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered ·

Transactions (tx()) API calls previously included in DSE Graph 6.7 and earlier versions (now referred to as "Classic Graph") are no longer supported in the new DataStax Graph in DSE 6.8. By design, tx() API calls will throw UnsupportedOperationException.

For more info, see What's new in DataStax Graph for a list of additions to the new Graph as well as a list of deprecated items. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

smadhavan avatar image
smadhavan answered ·

@rohansurana2810_190538, yes, per the DSE 6.8 Graph deprecation list, tx() graph API calls will throw an unsupported operation exception. We can do something like the below,

GraphTraversalSource gOLTP = DseGraph.traversal(dseSession, new GraphOptions().setGraphName("mygraph"));
GraphTraversalSource gOLAP = DseGraph.traversal(dseSession, new GraphOptions().setGraphName("myothergraph").setGraphSource(ANALYTICS_SOURCE_NAME));

Vertex v = gOLTP.V().has("name", "marko").next();
long count = gOLAP.V().count().next();
Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.