0 Replies Latest reply on Jun 23, 2005 9:59 AM by jgc195

    Committing rows during a transaction - is this possible?

    jgc195

      Hi all,

      I've got an interesting problem that I'm hoping will take someone 2 minsutes to answer!

      Probably best explained with an example. A system has two CMP entities called X and Y. There are 100000 instances of the X entity. A new instance of the Y entity has just been created, and needs to be related (through a CMR) to every X entity. (ie. newY.setRelatedX(XHome.findAll())

      Transactions are very important in this system and its configured with this in mind. Viewing the SQL log shows that everything between the 'findAll' (to get all the X entities) and all 100000 inserts into the CMR table occur in a single transaction. Incidentally, all 100000 instances of X are loaded.

      In the real life system I'm using, this transaction always fails because a lock can not be obtained on all 100000 entities at the same time in the db.

      What I would like to do is perform a commit after every 'insert' - is this possible?

      Persistence info is:
      persistence-type: Container
      MySQL Transaction Iisolation: TRANSACTION_READ_COMMITTED
      Commit Option: A

      Many thanks!

      Jason