Insertion Excep

29 views
Skip to first unread message

eswar reddy

unread,
May 2, 2016, 7:53:32 AM5/2/16
to OrientDB

when I am trying to insert with the following query

OrientGraphNoTx graph = factory.getNoTx();

  try {

String query = "INSERT INTO SuperMarket (Item,Code,Quantity) VALUES('banana',12.33,50)";

graph.command(new OCommandSQL(query).execute());

graph.commit();

} catch (Exception e) {

graph.rollback();

System.out.println(e);

} finally {

graph.shutdown();

}

I am getting exception but the query is executed(data inserted)

why its committed rather than rollback()

but actual query is  graph.command(new OCommandSQL(query)).execute();


please help me any one (I am connecting at remote db)


alessand...@gmail.com

unread,
May 2, 2016, 8:17:54 AM5/2/16
to orient-...@googlegroups.com
Hi,
you must replace
graph.command(new OCommandSQL(query).execute());

with 
graph.command(new OCommandSQL(query)).execute();

You can't do a rollback with a non-transactional graph.

Best regards,
Alessandro

eswar reddy

unread,
May 3, 2016, 1:39:18 AM5/3/16
to OrientDB
thanks for your suggestions but if I use transactional graph it didn't rollback.
when I use wrong query ( graph.command(new OCommandSQL(query).execute());


but the data is inserted into table

alessand...@gmail.com

unread,
May 3, 2016, 3:57:55 AM5/3/16
to OrientDB
Hi,
I tried your code with transactional graph and was not made the rollback.
Can you open an issue on github?

Best regards,
Alessandro
Reply all
Reply to author
Forward
0 new messages