TransactionScope Class - Is there an equivalent in JAVA?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JT

    TransactionScope Class - Is there an equivalent in JAVA?

    In .NET I have been using the TransactionScop e class to wrap my unit tests
    into a transaction and roll back any database changes after I have completed
    my unit test. Now I am dealing with some JAVA developers and looking for a
    similar way for them to be able to do this from their JAVA code and not at
    the database level. Is there and equivalent to this in JAVA? Thanks.


  • Jon Skeet [C# MVP]

    #2
    Re: TransactionScop e Class - Is there an equivalent in JAVA?

    JT <JT@hotmail.com wrote:
    In .NET I have been using the TransactionScop e class to wrap my unit tests
    into a transaction and roll back any database changes after I have completed
    my unit test. Now I am dealing with some JAVA developers and looking for a
    similar way for them to be able to do this from their JAVA code and not at
    the database level. Is there and equivalent to this in JAVA? Thanks.
    There are various transaction types available in Java (only the stock
    ticker is capitalized btw). It depends on which framework you're using.
    For instance, Spring provides its own transaction scoping objects, as
    does J2EE IIRC.

    --
    Jon Skeet - <skeet@pobox.co m>
    http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
    If replying to the group, please do not mail me too

    Comment

    • JT

      #3
      Re: TransactionScop e Class - Is there an equivalent in JAVA?

      They want to use EJB3 which I do not know anything about. Thanks.


      "Jon Skeet [C# MVP]" <skeet@pobox.co mwrote in message
      news:MPG.21958a 9d4ebdfe5b5bb@m snews.microsoft .com...
      JT <JT@hotmail.com wrote:
      >In .NET I have been using the TransactionScop e class to wrap my unit
      >tests
      >into a transaction and roll back any database changes after I have
      >completed
      >my unit test. Now I am dealing with some JAVA developers and looking for
      >a
      >similar way for them to be able to do this from their JAVA code and not
      >at
      >the database level. Is there and equivalent to this in JAVA? Thanks.
      >
      There are various transaction types available in Java (only the stock
      ticker is capitalized btw). It depends on which framework you're using.
      For instance, Spring provides its own transaction scoping objects, as
      does J2EE IIRC.
      >
      --
      Jon Skeet - <skeet@pobox.co m>
      http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
      If replying to the group, please do not mail me too

      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: TransactionScop e Class - Is there an equivalent in JAVA?

        JT <JT@hotmail.com wrote:
        They want to use EJB3 which I do not know anything about. Thanks.
        Okay - there's certainly the concept of transaction scopes within EJB3,
        although I can't remember the details. If you show them your .NET code
        and explain what it does, they should be able to do a similar thing in
        Java.

        Personally I don't do that though - I create appropriate conditions in
        the unit test database at the start of each test, but don't remove
        anything at the end. Each test needs to be able to set itself up
        completely. This is less efficient, but does have the advantage that if
        a test fails, you can see the state of the database at the point of
        failure. It also means you can test code which *does* commit
        transactions :)

        --
        Jon Skeet - <skeet@pobox.co m>
        http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
        If replying to the group, please do not mail me too

        Comment

        • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

          #5
          Re: TransactionScop e Class - Is there an equivalent in JAVA?

          Jon Skeet [C# MVP] wrote:
          JT <JT@hotmail.com wrote:
          >They want to use EJB3 which I do not know anything about. Thanks.
          >
          Okay - there's certainly the concept of transaction scopes within EJB3,
          although I can't remember the details.
          EJB certainly has transactions support, but EJB transactions
          stuff (except for BMT) are much more like the stuff in
          System.Enterpri seServices.

          Arne

          Comment

          Working...