2 Replies Latest reply on Mar 14, 2011 3:41 PM by William Borgo

    Multiple EM persist

    William Borgo Newbie


      I'm new to Seam and I want to execute a entityManager multiple times in a loop. I want to insert a couple of rows in database. Here's my code:

      SadPerguntasEmbaralhadas spe = new SadPerguntasEmbaralhadas();
      for (int i=1; i< mSession.getListPerguntasEmbaralhadas().size(); i++){
           spe.setIdMat(new Integer(mSession.getMatricula()));
           spe.setIdProva(new Integer(mSession.getIdProva()));               

      The problem is: only the firt row is inserted, the others is executed as a Update to that row in database. In other words, I see in the database just the last row.

      Anyone can help me? How can I make a multiple insert?