Closed
Description
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:
- Loading the entity does not populate null values ( does not create property: value entry ) in EntityImplementation.values
- Initializing a new entity via the Entity factory companion does populate null values ( creates property: value entry ) in EntityImplementation.values
- 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 }