3 Replies Latest reply on Oct 11, 2001 5:34 AM by rfred999

    BMP, file and transaction

    rfred999

      i want to use file to store my ejb entity bean, not a database because it's necessary in my work system. ok i found a ibm sample to do that: http://www-4.ibm.com/software/webservers/appserv/doc/CORBA/devguide/crbobjs.html

      My question
      when we use bmp, are transactions managed? for example, in a session bean, we create, update and distroy many entity beans. if an operation failed, how cancel previous operations, like update and detroy methods? is it automatic? if yes, what jboss do to do that?
      it's very important for me that, if a problem is encountered, all previous methods are cancelled. but, ejbCreate, ejbStore and ejbRemove write on disk the updates! so is it safe?

        • 1. Re: BMP, file and transaction
          marc.fleury


          > My question
          > when we use bmp, are transactions managed? for
          > example, in a session bean, we create, update and
          > distroy many entity beans. if an operation failed,
          > how cancel previous operations, like update and
          > detroy methods? is it automatic? if yes, what jboss
          > do to do that?

          Yes it is automatic in CMT (Container Managed Transaction) which is the only setting for entities. You control it with the same tags.

          • 2. Re: BMP, file and transaction
            davidjencks

            You may want to find a more up to date tutorial on ejb's. The jboss manual has some accurate info.

            Unless you write a file-based jca resource adapter, you shouldn't use files to store your entity bean state: you aren't supposed to write to files from an ejb. Furthermore, most file systems are not transactional: there is normally no "commit" operation on a file write. So although jboss will happily try to manage transactions for you with BMP entity beans, if you don't have a transactional resource manager (database) it won't do you any good: there is nothing to do the commit or rollback on.

            So, if I understood your question correctly to be about using file based persistence with bmp, it is not safe.

            • 3. Re: BMP, file and transaction
              rfred999

              > You may want to find a more up to date tutorial on
              > ejb's. The jboss manual has some accurate info.
              >
              > Unless you write a file-based jca resource adapter,
              > you shouldn't use files to store your entity bean
              > state: you aren't supposed to write to files from an
              > ejb. Furthermore, most file systems are not
              > transactional: there is normally no "commit"
              > operation on a file write. So although jboss will
              > happily try to manage transactions for you with BMP
              > entity beans, if you don't have a transactional
              > resource manager (database) it won't do you any good:
              > there is nothing to do the commit or rollback on.
              >
              > So, if I understood your question correctly to be
              > about using file based persistence with bmp, it is
              > not safe.

              So, using file is not safe. But have we a solution? We want to store our data in xml file.