title: Is it ok to persist the Child entity along with the Parent entity when having a One-To-One JPA relationship in between them?
body: <p>I am having two Entity classes, <code>Company</code> and <code>CompanyTypeAutomobile</code>.<br>
  These two have <code>One-To-One</code> relationships.</p>
  
  <pre><code>public class Company {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
      @GenericGenerator(name = "native", strategy = "native")
      @Column(name = "company_id", unique = true, nullable = false)
      private Integer companyId;
  
      @Column(name = "name", length = 255, updatable = false)
      @NotEmpty
      private String name;
  
      private CompanyType companyType;
  
      //other fields
  
  }
  
  public class CompanyTypeAutomobile {
  
      @Id
      private Integer id;
  
      @JsonIgnore
      @OneToOne(fetch = FetchType.LAZY)
      @MapsId
      @JoinColumn(name = "company_id")
      private Company company;
  
  }
  </code></pre>
  
  <p><code>Company</code> contains the basic details of a company, and the other fields would be contained in its child entity(based on the type of Company)
  Now, when If <code>Company</code> is created, should I create the <code>CompanyTypeAutomobile</code> also in the same process? </p>
  
  <p>I am having a requirement where I am in such a situation. If for some company, it has only basic details in <code>Company</code> and other details were not created and I want GET the complete details of the company then the persistence layer would return me <code>EntityNotFoundException</code> for <code>CompanyTypeAutomobile</code>.</p>
  
  <p>So I just want to create the child entity, only with the <code>id</code> field. Is it a good practice?</p>