java - Transaction Management in Orient DB -
i using using below logic start transaction in orient db. observing if transaction not closed inside method, auto available other method, seems leak me. try explain scenario below: graphfactory.getdatabase().begin(type);
public <t> void addvertextodb(t data){ graphfactory.getdatabase().begin(otransaction.txtype.optimistic); //logic fetching data , adding vertex //i neither calling rollback nor commit here } i have method update
public <t> void updatevertextodb(t data){ //not starting transaction explicitly , doing write operation //logic fetching data , adding vertex //i neither calling rollback nor commit here } the graph factory has below property set
graphfactory.setautostarttx(false); graphfactory.setrequiretransaction(true); expectation: updatevertextodb should throw otransactionexception e current behavior: gets transcation started save , working fine.
so wanted know how can achieve behavior if method not starting transcation , trying write db, must throw otransactionexception e until not nested inside method running transaction.
what's graphfactory? name misleading. doesn't orientgraphfactory, rather orientgraph object, right?
anyway, call graphfactory.getdatabase().begin(otransaction.txtype.optimistic); you're bypassing graphapi. if use graph api behaviour should expected one. try calling graphfactory.begin();
Comments
Post a Comment