1

In my program, I have a Task model with a allDates field, which is a collection of all the Dates that task occurs on. My goal is to make a calendar manager that allows users to input tasks that repeat on certain days.

In Tasks, I defined a OneToMany relation between a task and its dates in line 34. To treat the elements of allDates as an entity, I wrapped each date in a DateHelper model that is another Ebean entity.

Right before I save the Task, my console output indicates someTask.allDates.size() is accurate and a number greater than one. After I save the task, however:

1) I query DateHelpers in line 194 for all DateHelper instances for a given task, and the server only returns the first DateHelper that was added to someTask.allDates, rather than returning the same number of DateHelpers that was added to the task before I saved.

2) someTask.allDates.size() also returns 1, and the only element in allDates is the first DateHelper I added before saving the task.

I read here and here that Play developers should modify a persistence.xml file to integrate with JPA. Do I need to do this if I am importing ebean? Also, my program successfully maps one User to many Tasks, so I am confused about why the OneToMany mapping does not work for one Task to many TaskHelpers.

Community
  • 1
  • 1
Emily Chen
  • 247
  • 1
  • 3
  • 8

0 Answers0