title: Hibernate/JPA and PostgreSQL - Primary Key?
body: <p>I'm trying to implement some basic entities using Hibernate/JPA.  Initially the code was deployed on MySQL and was working fine.  Now, I'm porting it over to use PostgreSQL.  In MySQL, my entity class defines its primary key as an auto-incrementing long value with the following syntax:</p>
  
  <pre><code>    @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
  </code></pre>
  
  <p>However, I've found that I get errors with PostgreSQL when I try and insert numerous records at a time.  What do I need to annotate my primary key with to get the same auto-incrementing behavior in PostgreSQL as I have with MySQL?  Thanks for any help you can provide!</p>