1 Reply Latest reply on Apr 28, 2004 2:18 AM by aloubyansky

    Duplicate storeing of a CMP-Bean

    wdfink

      Hi all,
      I have a nasty Problem when I start a Bean with an empty Database:

      My scenario
      one StatelesSessionBean with a method createXX() transaction=Required
      In this Method a CMP-Bean named COUNTER is called to find a Entity with a primarykey. If this primarykey does not exists the HomeInterface create() Method is called.

      If two different Clients call the StatelessSessionBean at the same time I found afterwards to Databaseentries with this Primarykey.

      If I use Oracle-DS (local-tx) a Warning occour:

      13:35:44,348 WARN TxConnectionManager Prepare called on a local tx. Use of local transactions on a jta transaction with more than one branch may result in inconsistent data in some cases of failure.


      If I use Oracle-DS (xa-datasource) no warning occour but the result is the same.

      If the Bean exists (in DS) all work fine.
      IMO the configuration for container-transaction should correct.

      finnaly I have no idea for a solution of this (my) problem .

      thanks for posting
      Wolf

        • 1. Re: Duplicate storeing of a CMP-Bean
          aloubyansky

          An attempt to create an instance with existing primary key should fail unless you are using

           <entity-command name="no-select-before-insert"/>
          


          The warning is caused by an attempt to enlist more than one resource in the local transaction that does not support 2 phase commit which is required in this case. This is what XA for.