Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have been trying some things, and the closest I get to what you want is this(check the setter <code>setCourse</code> in the <code>CourseSchedule</code> class):</p> <p>Course</p> <pre><code>@Embeddable public class Course implements Serializable { @Column(name = "TERM_CODE") private Long termCode; @Column(name = "SUBJECT_CODE") private String subjectCode; @Transient Collection&lt;CourseSchedule&gt; schedule = new ArrayList&lt;CourseSchedule&gt;(); public void setSchedule(Collection&lt;CourseSchedule&gt; schedule) { this.schedule = schedule; } public Collection&lt;CourseSchedule&gt; getSchedule() { return schedule; } public Long getTermCode() { return termCode; } public void setTermCode(Long termCode) { this.termCode = termCode; } public String getSubjectCode() { return subjectCode; } public void setSubjectCode(String subjectCode) { this.subjectCode = subjectCode; } } </code></pre> <p>CourseSchedule</p> <pre><code>@Entity(name="Course") public class CourseSchedule { private String room; private String day; @Id @GeneratedValue private int id; public int getId() { return id; } public void setId(int id) { this.id = id; } @Embedded private Course course; public Course getCourse() { return course; } public void setCourse(Course course) { course.schedule.add(this); this.course = course; } public String getRoom() { return room; } public void setRoom(String room) { this.room = room; } public String getDay() { return day; } public void setDay(String day) { this.day = day; } } </code></pre> <p>generated database table</p> <pre><code>id subject_code term_code day room 1 "EGRE" 201220 "TR" "0101" 2 "EGRE" 201220 "W" "0103" </code></pre> <p>Basically the other way around. It isn't completely what you expect, but it might inspire you for a better solution, please keep me updated if you have more ideas or found something interesting...</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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