| Author |
problem of rollback()
|
payal Jain
Ranch Hand
Joined: Dec 20, 2007
Posts: 50
|
|
Hi i have an application of sending an card from one employee to other. On page 1:Employee selectes an Card page 2:He fills the info like his name,mail Id ,reciptents mail id ,name etc.. When he clicks on "Send" button the data base table gets updated with the information filled by the person on the page and then the mail is send to the reciptent saying he has recieve an card. Now when there is Exception while sending mail i need to do rollBack for the entry which I recently added. How can I do that , Any suggestion is appreciated. Thanks.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
You can wrap the whole operation in a transaction. See JTA. One thought though - email is not a guarenteed transport mechanism so do you really need to care if the email can't be sent?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
payal Jain
Ranch Hand
Joined: Dec 20, 2007
Posts: 50
|
|
can you just help me out with example... I saw the link you send ,but din't understood
|
 |
payal Jain
Ranch Hand
Joined: Dec 20, 2007
Posts: 50
|
|
please help me with some suggestions. I really need it urgently.
|
 |
Vinod K Singh
Ranch Hand
Joined: Sep 30, 2008
Posts: 198
|
|
|
Set autoCommit(false) for database connection. Now do the commit/rollback based on the success of insert and email sent.
|
My Blog
|
 |
Meet Gaurav
Ranch Hand
Joined: Oct 08, 2008
Posts: 492
|
|
|
Explain me more About your Application
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: problem of rollback()
|
|
|