Announcement Announcement Module
Collapse
No announcement yet.
No values displayed when NodeEntity object is converted to JSON with Jackson Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No values displayed when NodeEntity object is converted to JSON with Jackson

    Hi Guys,

    I've been searching for days but only found this thread -> http://forum.springsource.org/showth...N-with-Jackson w/c didn't helped me at all.

    The issue is that, no values displayed when nodeentity from db is converted to json. Please see the attached project.

  • #2
    ramirezag,

    I made a couple of changes to your pom, and `mvn clean test` is successful:

    Code:
            <repository>
                <id>neo</id>
                <name>neo</name>
                <url>http://m2.neo4j.org</url>
            </repository>
    ...
            <neo4j.version>1.8.RC1</neo4j.version>
            <spring.data.neo4j.version>2.1.0.RC4</spring.data.neo4j.version>
    Not sure what the problem was, but if we do not see it again that fine

    Regards,

    Lasse

    Comment


    • #3
      Thanks for these changes and sorry for the confusion. The issue is that, if you get User object
      Code:
      User result1 = userService.findByUid(user1.getUid());
      then deserialize result1 object
      Code:
      mapper.writerWithDefaultPrettyPrinter().writeValueAsString(user)
      username, password, email properties have no value.

      I uploaded the revised project here -> http://github.com/ramirezag/sdn-jack...on-problem.git. UserServiceImplTest will now fail in that project.

      Thanks

      Comment


      • #4
        Hi Guys,

        Can someone help me on this? I'm really clueless why domains fetched from db have problems when converted to json. If I simply instantiate a domain or object and then set the object's properties then convert it to json, I could see values of the properties.

        Comment


        • #5
          Hi,

          in the aspectj mapping mode your field access (within your class) is intercepted to be dynamically redirected to the neo4j store. So if anyone accesses the fields with reflection they won't contain any values. Try to serialize the bean getters instead.

          Can you try to use these Json annotations :

          Code:
          @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
          @JsonIgnoreProperties(value = {"persistentState","entityState","template","nodeId"})

          Comment


          • #6
            Wohooo. It worked. Thank you so much Michael

            Comment

            Working...
            X