title: @OneToOne Mapped as @OneToMany
body: <p>//@OneToOne Relationship turned mapped as @OneToMany by Spring data JPA / //hibernate in MySQL </p>
  
  <pre><code>@Entity
  @Table(name = "product")
  public class Product extends DataJournal {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
      private String name;
      private Double price;
  
      private Date dom;
      private Date expiryDate;
  
      @OneToOne(mappedBy = "product", optional = false)
      private Stock stock;
      //getters and setters
  }
  
  @Entity
  @Table(name = "stock")
  public class Stock extends DataJournal {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
      private Long quantity;
      private Long reOrderLabel;
  
      @OneToOne
      @JoinColumn(name="product_id")
      private Product product;
      //getters and setters
  }
  </code></pre>
  
  <p>//    Relation between Product and stock is as @OneToOne but it is mapped //as @OneToMany in Mysql, the following are reversed mysql database and //relation 
      [1]: <a href="https://imgur.com/a/OqC0Ddt" rel="nofollow noreferrer">https://imgur.com/a/OqC0Ddt</a>
      [2]: <a href="https://imgur.com/a/3fFMuDD" rel="nofollow noreferrer">https://imgur.com/a/3fFMuDD</a></p>