title: Many-to-many relationship in play framework java
body: <p>I am trying to use many to many approach product has many to many relation with shop
  <strong>Product.java</strong></p>
  
  <pre><code>package models;
  @Entity
  public class Product extends Model {
  
      @Id
      @SequenceGenerator(name="product_gen", sequenceName="product_id_seq", allocationSize=1)
      @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="product_gen")
      @Column(name="id")
      public Long id;
  
      @Required
      public String name;
  
      @Required
      public Float price;
  
      @ManyToMany(cascade = CascadeType.ALL)
      public List&lt;Shop&gt; shops = new ArrayList&lt;Shop&gt;();
  
      public Product(String name, float price) {
          this.name = name;
          this.price = price;
      }
      public static List&lt;Product&gt; all(){
          return find.all();
      }
      public static Model.Finder&lt;Long, Product&gt; find = new Model.Finder(Long.class, Product.class);
  
      public static Product create(String name,float price) {
          Product product = new Product(name, price);
          product.save();
          product.saveManyToManyAssociations("shops");
          return product;
      }
  
  
  
  
  }
  </code></pre>
  
  <p>play created a table product_shop which has shop_id and product_id as foreign key but not able to store any value in product_shop table on adding a product
  any help would be appreciated.</p>