Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[nosql-dev] parasite properties (issue 259)

Hello,

As I already described in the https://github.com/eclipse/jnosql/issues/259 , there is a strange jnosql behavior while deseriaizing from mongodb with an empty (absent) object property.

CitizenRepository repository = service.getCitizenRepository();

-----------------------------------------------------------------------------------
Citizen citizen = new Citizen();
citizen.setId("1234");
citizen.setName("Dmitry");

Citizen s = repository.save(citizen);

City city = s.getCity(); // ???
String name = city.getName(); // ???????
System.out.println("citizen.city.id = " + name);
-----------------------------------------------------------------------------------

There are two problems here.
1. Non existent "City" entity is created, while should be null
2. AbstractDocumentEntityConverter not only creates the "City" entity, but passes "Citizen" properties to initialize it, so we have the "City" with "id" and "name" taken from the "Citizen".

I attach my test project to see it.

Kind regards,

Dmitry


Attachment: nosql-test.zip
Description: Zip compressed data


Back to the top