@Test public void shouldCreateACustomer() throws Exception { Customer customer = new Customer("John", "Smith", "jsmith@gmail.com", "1234565"); tx.begin(); em.persist(customer); tx.commit(); Assertions.assertNotNull(customer.getId(), "Id should not be null"); }
@Id @GeneratedValue public Long getId() { return id; }
Customer { @Id @GeneratedValue public Long getId() { return id; } }
Customer { @Id @GeneratedValue public Long getId() { return id; } Customer();  Customer(String firstName, String lastName, String email, String phoneNumber); }
Customer { @Id @GeneratedValue public Long getId() { return id; } Customer();  Customer(String firstName, String lastName, String email, String phoneNumber); void setId(Long id); void setFirstName(String firstName); void setLastName(String lastName); void setEmail(String email); void setPhoneNumber(String phoneNumber); @Id @GeneratedValue Long getId(); @Column(name = "first_name", nullable = false, length = 50) String getFirstName(); @Column(name = "last_name", nullable = false, length = 50) String getLastName(); String getEmail(); @Column(name = "phone_number", length = 15) String getPhoneNumber(); }
Customer { @Id @GeneratedValue public Long getId() { return id; } Customer();  Customer(String firstName, String lastName, String email, String phoneNumber); void setId(Long id); void setFirstName(String firstName); void setLastName(String lastName); void setEmail(String email); void setPhoneNumber(String phoneNumber); @Id @GeneratedValue Long getId(); @Column(name = "first_name", nullable = false, length = 50) String getFirstName(); @Column(name = "last_name", nullable = false, length = 50) String getLastName(); String getEmail(); @Column(name = "phone_number", length = 15) String getPhoneNumber();  }