title: JPA not generating Id for entity
body: <p>I have the following class</p>
  <pre><code>  @Entity
    public class Comment {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = &quot;comment_id&quot;)
      private Long commentId;
  
      @Column(name = &quot;creator_id&quot;)
      private Long creatorId;
  
      @Column(name = &quot;text&quot;)
      @ApiModelProperty(value = &quot;Text des Kommentar&quot;)
      private String text;
  
      @Column(name = &quot;timestamp&quot;)
      @ApiModelProperty(value = &quot;Zeitstempel der letzten Bearbeitung&quot;)
      private String timestamp;
  
  
      protected Comment() {}
      
      public Comment(CommentDto dto) {
        this();
        updateComment(dto);
      }
  
      private void updateComment(CommentDto dto) {
        setText(dto.getText());
        setCreatorId(dto.getCreatorId());
        setTimestamp(UtilService.getTimestampString());
      }
  </code></pre>
  <p>I get a CommentDto from my HTTP-Request consisting of a the text and the creatorId.</p>
  <p>As far as I understand, the commentId should be generated through the call of the empty constructor.</p>
  <p>In my Service I do the following</p>
  <pre><code>public void addComment(CommentDto comment) {
    Comment commentEntity = new Comment(comment);
    commentRepository.save(commentEntity);
  }
  
  </code></pre>
  <p>With <code>commentRepository</code> being an Autowired <code>JPARepository&lt;Comment, Long&gt;</code></p>
  <p>The problem is, that the ID does not get generated and I get an error for trying to insert an object into my DB with a null id.</p>