Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object API does not propagate save over Set fields #8272

Closed
diegomtassis opened this issue May 17, 2018 · 5 comments
Closed

Object API does not propagate save over Set fields #8272

diegomtassis opened this issue May 17, 2018 · 5 comments
Assignees
Labels
Milestone

Comments

@diegomtassis
Copy link
Contributor

diegomtassis commented May 17, 2018

OrientDB Version: 2.2.35

Java Version: 8

OS: Windows, Linux

Expected behavior

A model where an entity is related to another entity by a one-to-many relationship implemented using a Set.
Scenario:

  1. fooEntity is created.
  2. barEntity is created.
  3. barEntity is added to fooEntity.
  4. fooEntity is saved.
  5. An entity retrievedFoo is retrieved from the database using fooEntity.id
  6. A property is set in retrievedBar (acessed via retrievedFoo). Both entity handlers are now dirty.
  7. retrievedFoo is saved.

Actual behavior

If the first save and the latter retrieve/save are executed using different connections (typical scenario in a multi thread application) the save operation is not propagated, and retrievedBar stays marked as dirty.

Steps to reproduce

I've created an integration test reproducing it.
PropagateSaveOnSetFieldIT

3 scenarios:

  • Master entity saved using a connection and later changes saved using the same connection. It works.
  • Master entity saved using a connection and later changes saved using a different connection. It fails.
  • same scenario than the former but the relationship is stored using a List instead of a Set. It works.

Something I have noticed while debugging is that when a single connection is used, when retrieved, the aggregate root's internal dirtyManager is not null (actually the root and the child share the same dirtyManager). In the scenario using different connections, when retrieved, the dirtyManager in the root entity is null.

@diegomtassis diegomtassis changed the title Obpect API does not propagate save over Set fields Object API does not propagate save over Set fields May 17, 2018
@luigidellaquila
Copy link
Member

Hi @diegomtassis

I pushed a fix for this issue, it will be released with v 3.0.2

Thanks

Luigi

@luigidellaquila luigidellaquila self-assigned this May 21, 2018
@luigidellaquila luigidellaquila added this to the 3.0.2 milestone May 21, 2018
@diegomtassis
Copy link
Contributor Author

diegomtassis commented May 21, 2018

Thanks @luigidellaquila.
Is it possible to backport the fix as well to 2.2.x?

@luigidellaquila
Copy link
Member

Yes, I think so, let me check

@luigidellaquila
Copy link
Member

Hi @diegomtassis

I just cherry-picked and pushed the fix to 2.2.x

Thanks

Luigi

@diegomtassis
Copy link
Contributor Author

Thanks @luigidellaquila.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants