• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem of rollback()

 
payal Jain
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
payal Jain
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you just help me out with example...
I saw the link you send ,but din't understood
 
payal Jain
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me with some suggestions.
I really need it urgently.
 
Vinod K Singh
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set autoCommit(false) for database connection. Now do the commit/rollback based on the success of insert and email sent.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Explain me more About your Application
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic