java - Transaction Management in Orient DB -


i using using below logic start transaction in orient db. graphfactory.getdatabase().begin(type); observing if transaction not closed inside method, auto available other method, seems leak me. try explain scenario below:

 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

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -