2

I am trying to have the example from https://github.com/neo4j-examples/neo4j-ogm-university work with the latest version (downloaded Jan 2018).

I made a small fix, proposed for merge into the code, to declare the use of checklist-model, and most of the code works after that. I have still a problem with @RelationshipEntity. The code uses it for Enrollments, so that when in a Student detail interface, I can add a course, and this should create a new Enrollment between the Student and the Course when saving.

In this scenario, I get an error:

[ratpack-compute-1-6] ERROR ratpack.error.internal.DefaultDevelopmentErrorHandler - exception thrown for request to /api/students
com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class school.domain.Enrollment] from Integral number (760); no single-int-arg constructor/factory method
 at [Source: io.netty.buffer.ByteBufInputStream@2aff08a1; line: 1, column: 17] (through reference chain: school.domain.Student["enrollments"]->java.util.HashSet[0])
        at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:255)

All I did is to modify src/assets/html/student-detail.html because the line was pointing to a non-existing model in the checklist-model

<label><input type="checkbox" class="form control pull-left"
    checklist-model="student.enrollments" checklist-value="class.id"/>&nbsp;{{class.name}}</label>

I thought the jackson deserialisation unit would call a constructor with both the ends of the edge (which does exist), but seems to search a constructor with only one arg. Any suggestion here? Thanks a lot for any suggestion, hj

logisima
  • 7,340
  • 1
  • 18
  • 31
hjohanns
  • 96
  • 8
  • It would be enough for me to understand if I would better avoid the area of @RelationshipEntity. From the lack of answer, I guess the answer is not that simple. – hjohanns Mar 07 '18 at 22:46

0 Answers0