3 Replies Latest reply on Jun 18, 2004 3:49 AM by u9707118

    EJB not committing

    u9707118 Newbie

      OK, let me first say that I am really new to JBOSS - so I'm probably doing something really stupid...

      In my code, I have a loop that creates a series of EJB's.
      In order to find a unique id, I use an sql statement to find the highest value primary key (say 6) and I increment by one (7).

      This works for creating the first EJB in the loop - however, on the 2nd iteration of the loop, the sql statement returns a high primary key of 6 (again - as if the first ejb created is not reflected in the database). However, when I increment this value to 7 and try to create the next EJB, a DuplicateKeyException is thrown.

      What is going on?
      How can I commit data to the database when the EJB is created?

      Thanks

      Damian