title: Spring Data JPA; save() auto increment primary key error
body: <p>I have a USER table with UserId as primary key, which is int and auto incremented in MySQL. </p>
  
  <pre><code>@Id
  @GeneratedValue
  @Column(name="USER_ID")
  private Integer userId;
  </code></pre>
  
  <p>When I run userRepository.save(user); I am getting an error saying: org.springframework.beans.InvalidPropertyException: Invalid property 'userId' of bean class [com.mysite.model.User]: Getter for property 'userId' threw exception; nested exception is java.lang.reflect.InvocationTargetException</p>
  
  <p>If I just hard coded the user id I don't get this error. What am I doing wrong?</p>
  
  <pre><code>// hard code it
  user.setUserId(5);
  userRepository.save(user);
  </code></pre>