0 Replies Latest reply on Nov 13, 2001 10:11 PM by Verdi March

    connect and close connection in different method produce err

    Verdi March Newbie

      Actually I've post this topic in another forum (database-
      persistance) because at first I thought this has something to
      do with dbase, but lately I found it's not, so I move/repost
      this topic in this forum.

      I create a session bean (stetaful), open connection in create() and
      acvitivate(), close connection to dbase on remove() and passivate().

      Problem is if <trans-attribute> in ejb-jar.xml is Required or
      RequiresNew, each time a client (swing applicatioon) call remove(),
      will produce errors.

      However, if I change <trans-attribute> in ejb-jar.xml to Never or
      Supports for that stateful-bean, invocation of con.close()
      in ejbRemove() success.

      So far, I understand that if I use trans-attribute Never, the
      stateful-bean will execute method without transaction
      even if the client is in transaction context. For Supports,
      if client is in transaction context, statefull will also in transaction
      context, and if client isn't in transaction context, stateful
      bean execute without transaction. Since my client is a swing app,
      I believe that with <trans-attribute> Never or Supports,
      my sesion-bean will not executed in transaction mode if called by
      the siwng client.


      It seems that if stateful-bean is in transaction context, invocation of con.close()
      will fail, but why? Could somebody please enlight me?