0 Replies Latest reply on Oct 11, 2006 8:35 AM by abra cadabra

    Large data insert generates no line at database

    abra cadabra Newbie


      Im facing a problem and Im completely lost at it.

      I get the file through JSF component.
      What I have to do is read the file, line by line instantianting a new Entity that will have
      this String as an attribute. So, I create a List of the entities created.

      List list = new ArrayList();
      EntityB b = new EntityB();
      b.value = line;


      Also, I have another Entity that will receive this List.

      EntityA a = em.getEntityA(id);

      Finally, I try to merge EntityA, as I use cascade, EntityB will also be persisted.


      First problem:
      What is the best way of passing the file or its content to my SessionBean(Stateless)
      so I can iterate the content and persist it?

      What Im doing is read the UploadedFile (Adf Component) and write the content to a java.io.File,
      so I can pass it to the SessionBean but I dont think this is a good thing because these uploaded
      files are about 50 - 150 thounsand lines.

      Second problem:
      How do I persist those thousands of entities objects I created?
      I call em.persist and none is persisted.
      I tried to insert through native query and also no line is inserted.

      However when I try a smaller File with 15 thousand lines, the task is successfully done.

      Appreciate some help!