2 Replies Latest reply on Jan 2, 2008 6:16 AM by kavi arasu

    Em.persist in loop

    kavi arasu Newbie

      Hi i want to insert into database inside a loop
      i have 3 values in a loop i want to insert into DB one by or it by any way

      here i paste my sample coding

      String product[];
      for(String b:product)
      {
       for(TblProducts _proname:getproducts )
       {
       if(_proname.getProductName().equalsIgnoreCase(b))
       {
       productstore.setProductId(_proname);
       em.persist(productstore);
       }
       }
      }


      the product is a array which has 2 or many values i want to insert one by one
      thank u in advance
      REgards
      Kaviarasu