title: Does JPA @Id provide value if the table is auto-incrementing?
body: <p>This is something that I searched high and low for in the Hibernate docs and surprisingly couldn't find an answer for.</p>
  
  <p>Almost all canonical examples of Hibernate/JPA demonstrate configuring the primary key via the <code>@Id</code> annotation like so:</p>
  
  <pre><code>// Groovy pseudo-code!
  @Entity
  class Car {
    @Id
    @Column(name = "car_id")
    Long id
  
    @Column(name = "car_make")
    String make
  
    @Column(name = "car_model")
    String model
  }
  </code></pre>
  
  <p><strong>But</strong>, <em>if</em> I already have a pre-existing database, and <em>if</em> I plan on using Hibernate to merely <em>validate</em> that database instead of create one for me (via <code>hibernate.hbm2ddl.auto = validate</code>), and <em>if</em> my DB table is configured with an auto-incrementing primary key field, then of what value (at the <strong>application layer</strong>) does <code>@Id</code> provide me? Meaning, given:</p>
  
  <ul>
  <li><code>hibernate.hbm2ddl.auto = validate</code>; and</li>
  <li>The table/entity has an auto-incrementing PK (such as with MySQL <code>AUTO_INCREMENTING</code>)</li>
  </ul>
  
  <p>...then what does it matter to my application whether my entity class has <code>@Id</code> in it or not? Why couldn't I just write it like:</p>
  
  <pre><code>// Groovy pseudo-code!
  @Entity
  class Car {
    @Column(name = "car_id")
    Long id
  
    @Column(name = "car_make")
    String make
  
    @Column(name = "car_model")
    String model
  }
  </code></pre>
  
  <p>Or does <code>@Id</code> still provide value to my app in some way (if so, how)?</p>