2 Replies Latest reply on Jul 29, 2005 6:26 PM by binario

    Hibernate NonUniqueObjectException when creating several obj

    binario

      Hi all,

      I process files in the following order:

      1) Struts Action which contains a method that logicall does the following:

       MyObject m = new MyObject();
       for(int 1 = 0; i< someVar: i++){
       mySLSB.persistSomeEJB3Object(m);
       }
      


      where mySLSB is an ejb3 stateless session bean and MyObject is an ejb3 entity bean.

      Unfotunately when the for loop iterates more than one time I get a hibernate "NonUniqueObjectException". Now I understand that this object has been created already but the id is an automatically generated primary key so I would have presumed that I could create as many of them as I liked.

      Any ideas? Thanks very much.
      regards,
      Binario