1

Prior to SB2.4neo4j6, if i had a boolean node property, and it had no value saved in the db, it was automatically set as false at mapping into the @Node marked pojo and caused no problem.

In this new Spring boot 2.4 neo4j 6 however it throws an exception that null cannot be mapped to boolean value.

Should i now set up some Null to boolean conversion or what should i do? Tried with "GenericConverter" and also with Neo4jPersistentPropertyConverter with @ConvertWith on the property in manymany ways with Boolean and NullValue and Object and so on.

What would be a way to solve this?(cant do database update to give all non existent booleans a value)

1 Answer 1

0

Why can't you do a database update to set the value. Have you looked at Liquibase?

https://www.liquibase.org/

With that, a changeset like this:

<query>
   MATCH (n:WhateverNode) WHERE NOT exists(n.flag) SET n.flag=false RETURN n
</query>

Would cleanly update your database so that you don't need any tricky converters.

1
  • 1
    sure it would be possible, for whatever reason tho, i am not allowed to by someone who knows more about the project/db as i do. In the end i just changed the primitives to the wrapper class(Boolean), and gave them e getter which returns the default value if its null. Definietly not a nice solution/one that i wanted, but it works. Apr 12, 2021 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.