-
Notifications
You must be signed in to change notification settings - Fork 616
Description
Hi everybody!
I have a problem, when property names on different classes are identical.
Sometimes the correct property values are retrieved from the db, sometimes they are not.
The content stored in the database seems to be ok each time.
Data model
A Company
has multiple employees which are of type Person
.
Person
is subclassed by Developer
and Sales
.
Developer
has two properties firstLanguage
and secondLanguage
, which both are of type ProgrammingLanguage
.
Sales
has two properties firstLanguage
and secondLanguage
, which are of type NatualLanguage
Use case
The small example application creates a company with one developer and one sales person.
Both employees have their languages set up accordingly.
The data is written to the db and then retrieved again.
Problem
In some cases, firstLanguage
and secondLanguage
are null
for both persons.
The whole process (setup, store, retrieve) is executed in a loop.
If loading fails, it does so for all iterations.
If it is successfull, all iterations return correct results.
So the code behaves different for each application start.
Workaround
Using different property names seems to circumvent the problem, but might be difficult to maintain on growing data models.