Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen is persistence.xml necessary for Play 2.1.1 Java? Entities don't persist in a many-to-one relationship
    primarykey
    data
    text
    <p>In my program, I have a Task model with a <code>allDates</code> 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.</p> <p>In Tasks, I defined a OneToMany relation between a task and its dates in <a href="https://github.com/six5532one/calpractice2/blob/repeatingEvents/app/models/Task.java" rel="nofollow noreferrer">line 34</a>. To treat the elements of <code>allDates</code> as an entity, I wrapped each date in a DateHelper model that is another Ebean entity.</p> <p>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:</p> <p>1) I query DateHelpers in <a href="https://github.com/six5532one/calpractice2/blob/repeatingEvents/app/models/Task.java" rel="nofollow noreferrer">line 194</a> 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.</p> <p>2) someTask.allDates.size() also returns 1, and the only element in allDates is the first DateHelper I added before saving the task.</p> <p>I read <a href="https://stackoverflow.com/questions/6257284/play-framework-jpa-how-to-implement-one-to-many-relationship">here</a> and <a href="http://www.playframework.com/documentation/2.1.1/JavaJPA" rel="nofollow noreferrer">here</a> 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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload