title: I have an error when accessing a field with JPA. How do I solve this?
body: <p>When trying to insert values into my table, i get this error</p>
  
  <pre><code>org.hibernate.property.access.spi.PropertyAccessException: Error accessing 
  field [private int com.app.demo.model.Customer.id] by reflection for 
  persistent property [com.app.demo.model.Customer#id] : 
  com.app.demo.model.Customer@6d1c6e1e
  javax.persistence.PersistenceException: 
  org.hibernate.property.access.spi.PropertyAccessException: Error accessing 
  field [private int com.app.demo.model.Customer.id] by reflection for 
  persistent property [com.app.demo.model.Customer#id] : com.app.demo.model.Customer@6d1c6e1e
  </code></pre>
  
  <p>This is my customer table. I am using MySql Workbench, and I am trying to insert my values into here.</p>
  
  <p><a href="https://i.stack.imgur.com/ZpzqN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZpzqN.png" alt="Table"></a></p>
  
  <p>And i am using using this class to insert values into the table</p>
  
  <pre><code>@Entity
  @Table(name="customer")
  public class Customer {
  
  @Id
  @GeneratedValue
  @Column(name = "customer_id", unique = true, nullable = false)
  private int id;
  @Column(name="first_name")
  private String firstName;
  @Column(name="last_name")
  private String lastName;
  @Column(name="street_address")
  private String address;
  @Column(name="city")
  private String city;
  @Column(name="state")
  private String state;
  @Column(name="zip_code")
  private String zipcode;
  @Column(name="email")
  private String email;
  @Column(name="paypal_email")
  private String paypalEmail;
  
  
  // getters and setters
  </code></pre>
  
  <p>And this is how I am inserting values into my table</p>
  
  <pre><code>// Set customer values
  Customer valuedCustomer = new Customer();
  
  valuedCustomer.setFirstName(firstName);
  valuedCustomer.setLastName(lastName);
  valuedCustomer.setAddress(address);
  valuedCustomer.setCity(city);
  valuedCustomer.setState(state);
  valuedCustomer.setZipcode(zip);
  valuedCustomer.setEmail(email);
  
  // insert customer info into the customer table
  EntityManagerFactory emf = Persistence.createEntityManagerFactory("pu");
  
  EntityManager em = emf.createEntityManager();
  
  em.getTransaction().begin();
  em.persist(valuedCustomer);
  em.getTransaction().commit();
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>My customer table</p>
  
  <p><a href="https://i.stack.imgur.com/BdxWR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BdxWR.png" alt="customer table"></a></p>
  
  <p>My user table (this table i did the unit test on)</p>
  
  <p><a href="https://i.stack.imgur.com/79h4d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/79h4d.png" alt="user table"></a></p>