title: How to insert data which I get from an List into Database using Entitymanager (Hibernate)?
body: <p>I  have a List and I want to add to add the data which I get from the list into the database.
  My code is:</p>
  
  <pre><code>List&lt;EventPayload&gt; mylist=eventpojo.getEventPayload();
  
              for(EventPayload array : mylist)
              {
                  System.out.println("Comment Text :"+array.getCommentText());
                  System.out.println("Comment Type :"+array.getCommentType());
                  System.out.println("Comment Id :"+array.getCommentId());
                  System.out.println("Email id :"+array.getComment_email());
                  String email1=array.getComment_email();
                  EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("jcg-JPA");
                  EntityManager em = entityManagerFactory.createEntityManager();
  
  
                  List email=em.createQuery("SELECT usrinfo.user_id FROM UserInfo usrinfo WHERE usrinfo.email_id = :id").setParameter("id", email1).getResultList();
                  String userid=email.get(0).toString();
                  System.out.println("User id:"+userid);
                  Date date = new Date();
                  PageInfo pageinfo=new PageInfo();
                  pageinfo.setComment_id(array.getCommentId());
                  pageinfo.setComment_text(array.getCommentText());
                  pageinfo.setComment_type(array.getCommentType());
                  String date1=sdf.format(date);
                  pageinfo.setCreation_date(sdf.parse(date1));
                  pageinfo.setModification_date(sdf.parse(date1));
                  pageinfo.setRetrospective_id(eventpojo.getEventRetrospectiveId());
                  int user_id = Integer.parseInt(userid);
                  pageinfo.setUser_id(user_id);
                  em.persist(pageinfo);
  
                  }
  </code></pre>
  
  <p>I have all the tables mapped with the POJOS and it is working fine.I just want to add the <code>CommentText</code> <code>Comment type</code> <code>comment Id</code> <code>Email Id</code> <code>Creation Date</code> <code>Modification date</code> and <code>RetrospectiveID</code>.I have a table PAGEINFO and also a POJO named PageInfo with these 7 fields.Kindly help</p>