title: Mapping of Set requires Id?
body: <p>i have a mapping problem with spring data jdbc as following:<br>
  <code>Student</code> entity:</p>
  
  <pre><code>@Value(staticConstructor = "of")
  public class Student {
  
  private final @Id
  @Wither
  long studentId;
  
  @NotNull
  @Size(min = 4, max = 20)
  private String userId;
  
  @NotNull
  @Min(0)
  private int matriculationNumber;
  
  @NotNull
  @Email
  private String eMail;
  
  private @Wither
  Set&lt;StudentSubjectRegistration&gt; studentSubjectRegistrations;
  }
  </code></pre>
  
  <p>Next i have a <code>StudentSubjectRegistration</code> entity:</p>
  
  <pre><code>@Value(staticConstructor = "of")
  public class StudentSubjectRegistration {
  
  @NotNull
  private String electiveType;
  
  @NotNull
  private LocalDateTime created;
  
  @NotNull
  private long subjectid;
  }
  </code></pre>
  
  <p>When i run a test to find one specific student as illustrated here:</p>
  
  <pre><code>@Test
  public void findOneStudent() throws InterruptedException, ExecutionException {
      long studentId = 2L;
      Future&lt;Student&gt; student = studentService.findById(2L);
      while (!student.isDone()) {
          Thread.sleep(100);
      }
      assertThat(student.get()).isNotNull();
      assertThat(student.get().getStudentId()).isEqualTo(studentId);
  }
  </code></pre>
  
  <p>The console says that there is one sql statement issued:
  <code>Executing prepared SQL statement [SELECT student.studentid AS studentid, student.userid AS userid, student.matriculationnumber AS matriculationnumber, student.email AS email FROM student WHERE student.studentid = ?]</code></p>
  
  <p>As for my understanding there should another sql statement be issued to fetch the associated registrations, shouldn´t it?</p>
  
  <p>Instead there is an exception happening:
  <code>java.lang.IllegalStateException: Required identifier property not found for class de.thd.awp.student.StudentSubjectRegistration!</code></p>
  
  <p>Do i have to model the <code>StudentSubjectRegistration</code> with an <code>@Id</code>?</p>
  
  <p><code>StudentSubjectRegistration</code> should not be an aggregate root. It should be a reference from <code>Student</code> where its registrations are saved.</p>
  
  <p>Am i missing something?</p>
  
  <p>Please note furthermore my trying to model entity immutability inspired by this blog post <a href="https://spring.io/blog/2018/09/27/what-s-new-in-spring-data-lovelace" rel="nofollow noreferrer">https://spring.io/blog/2018/09/27/what-s-new-in-spring-data-lovelace</a> ...</p>
  
  <p>Am i doing things right?</p>
  
  <p>Thanks for your help!</p>