Skip to content

OrientGraphNoTx commits updates to OrientElement even if OValidationException is thrown #7145

@shooit

Description

@shooit

OrientDB Version: 2.2.16

Java Version: 1.8

OS: Ubuntu

Expected behavior

When using a non-transactional graph, an exception should be thrown when you try to update an element in a way that would violate a constraint, and the update should not commit.

Actual behavior

The exception is thrown but the update commits and there is no way to roll back.

Steps to reproduce

@Test
public void testNoTxGraphConstraints() {
    String location = "memory:test_noTxConstraints";
    OrientGraphNoTx graphNoTx = new OrientGraphNoTx(location);
    OrientVertexType testType = graphNoTx.createVertexType("Test");
    OProperty age= testType.createProperty("age", OType.INTEGER).setMax("3");
    OrientVertex vert1 = graphNoTx.addVertex("class:Test", "age", 2);

    try {
        vert1.setProperty("age", 4);
    } catch (OValidationException e) {
        Assert.assertEquals(vert1.getProperty("age"), 2); //this fails
    } finally {
        graphNoTx.drop();
    }
}

Metadata

Metadata

Assignees

Labels

buglegacy not used anymore

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions