Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Save on entity that links to itself through another entity is often not successful. #85

@dijef

Description

@dijef

I have three entity classes: A, B, C.
A contains list of B (OneToMany, Lazy)
B contains A (ManyToOne, lazy)
B contains list of C (OneToMany, Lazy)
C contains B (ManyToOne, lazy)
All entities have their POJOs to which they're converted after retrieve.

When retrieving them, ODirtyManager class marks entity being retrieved as dirty when resolving foreign keys. However ODirtyManager is not cleared for retrieved entity. So on next retrieve and an attempt to save same entity often actual save is overriden by older copy of same entity held by ODirityManager (set are used, so I guess that's why outcome is random).

My test do (and refreshes objects after each read):
addBtoA(a, b1);
addBtoA(a, b2);
addCtoB(b1, c1);
addCtoB(b1, c2);
addCtoB(b2, c3);
addCtoB(b2, c4);

and finally sets boolean value on c to true.
setTest(c1, true);

Tests randomly fails at different stages, rarely passes. When using OrientDBObject with same entity classes issue does not happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions