title: Divide a JPA entity into two?
body: <p>Assume I have the following entity:</p>
  
  <pre><code>@Entity
  @Table (name = "customers)
  public class CustomerImpl implements Customer {
  
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "id", nullable = false, unique = true)
  private Long id;
  
  @Column(name = "name", nullable = false)
  private String name;
  
  @Column(name = "surname", nullable = false)
  private String surname;
  
  @Column(name = "country", nullable = false)
  private String country;
  
  @Column(name = "city", nullable = false)
  private String city;
  
  @Column(name = "street", nullable = false)
  private String street;
  
  @Column(name = "zipCode", nullable = false)
  private String zipCode;
  
  // constructor + getters
  
  }
  </code></pre>
  
  <p>I want to create a new class called <strong>Address</strong> which will hold country, street, city and zip code variables. The outlined variables will be then replaced with Address object to make code more readable and cleaner. </p>
  
  <p>In my case, should the Address class be embedded or should I assign it as new entity and give @OneToOne relationship between Address and Customer? </p>
  
  <p>Thank you</p>