Here the code with some more comments to help understand my case a bit
better:
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientGraphFactory;
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
/**
* Created by mohamnag on 03/06/15.
*/
public class test {
private static OrientGraphFactory graphFactory = new
OrientGraphFactory("memory:testdb", "admin", "admin");
public static void main(String[] args) {
OrientGraph graph = graphFactory.getTx();
graph.executeOutsideTx(noTx -> {
noTx.createVertexType("test");
return null;
});
OrientVertex vertex = graph.addVertex("class:test");
//<<<<<< this is a call to another function which does somethings
in a sub-transaction
OrientGraph graph2 = graphFactory.getTx();
OrientVertex vertex2 = graph2.addVertex("class:test");
// do something with vertex2, set properties
graph2.commit();
//>>>>>> here we return to original function
// now we continue own business in outer transaction
vertex.setProperty("test", "value");
graph.commit();
}
}
On Thursday, June 4, 2015 at 11:34:15 AM UTC+2, Mohammad Naghavi wrote:
>
> I can not do that. The fact is that this code is a simplified version of
> my whole application. There is function in class A which starts with a
> transaction to save some data into DB, then it calls another function in
> class B which also starts a (sub-) transaction to store something in DB and
> when class B is finished it can commit its own transaction or roll it back.
> Afterwards class A has to do some other tasks and just after that it can
> commit (or rollback) the outer transaction.
>
> I want to use the automatic rollback of outer transaction when inner
> transaction is rolled back as it is described in documentation of orientdb.
> It seems this functionality is brocken since 2.0.9 as when I test using
> 2.0.8 there will be no exception. The same applies when I use a 2.0.10
> remote orientdb instance.
>
>
> On Thursday, June 4, 2015 at 11:00:02 AM UTC+2, [email protected]
> wrote:
>>
>> Hi Mohammad,
>> I tried your code using the graph java api and v2.0.10 of orientdb and it
>> works.
>>
>> Try to write :
>>
>> OrientVertex vertex = graph.addVertex("class:test");
>> graph.commit()
>> OrientGraph graph2 = graphFactory.getTx();
>> vertex.setProperty("test", "value");
>>
>> Regards,
>> Alessandro
>>
>>
>>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.