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

Equals does not work correctly on entities with nullable properties #466

Closed
IvanGeorgiev89 opened this issue Dec 21, 2022 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@IvanGeorgiev89
Copy link

Currently equals does not work correctly on entities with nullable properties.

This is a side-effect of inconsistency when populating the values map in EntityImplementation:

  1. Loading the entity does not populate null values ( does not create property: value entry ) in EntityImplementation.values
  2. Initializing a new entity via the Entity factory companion does populate null values ( creates property: value entry ) in EntityImplementation.values
  3. EntityImplementation delegates equals() to the LinkedHashMap holding the values.

Therefore for an entity declared as E(A, B, C?):
if we do :

  • e1 = E { a1, b1, null }
  • database.sequenceOf(E).add(e1)

Then we get

  • e1 != database.sequenceOf(E).find { it.a eq a1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants