Skip to content

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

Closed
@IvanGeorgiev89

Description

@IvanGeorgiev89

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 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions