| Author |
Help with implementing user transaction
|
kartik krishnan
Ranch Hand
Joined: Nov 19, 2006
Posts: 63
|
|
Hi,
For our database calls, we are executing database calls outside of the J2EE container. It is not possible for us look up implementation of UserTransaction from JNDI. We have to manage our own transactions. Is there an implementation of javax.transaction.UserTransaction that works outside of J2EE Container? If there is not one, any help in writing one would be appreciated.
Thanks,
Karthik
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
|
|
|
For JDBC, why do you need UserTransaction? You can just use commit and rollback on the connection.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
kartik krishnan
Ranch Hand
Joined: Nov 19, 2006
Posts: 63
|
|
Hi Jeanne,
when we are testing CRUD calls with our dao layer, it is required to roll back the query back to our known state regardless of whether the test fails or succeeds. I was thinking of implementing UserTransaction for this purpose.
Thanks,
Karthik
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
|
|
|
Take a look at DB Unit. It handles the case you describe and lets you have transactions within it too.
|
 |
kartik krishnan
Ranch Hand
Joined: Nov 19, 2006
Posts: 63
|
|
Hi Jeanne, I will look at that.
Thanks
Kartik
|
 |
 |
|
|
subject: Help with implementing user transaction
|
|
|