This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with implementing user transaction

 
kartik krishnan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34179
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For JDBC, why do you need UserTransaction? You can just use commit and rollback on the connection.
 
kartik krishnan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34179
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at DB Unit. It handles the case you describe and lets you have transactions within it too.
 
kartik krishnan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne, I will look at that.

Thanks

Kartik
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic