Announcement Announcement Module
Collapse
No announcement yet.
any exception handler for @tranasactional ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • any exception handler for @tranasactional ?

    hi,

    I have a @transactional save(Image img), if Runtime transaction occurs, then the database will rollback.

    but when i save image file in the file system, i want to delete the file if any runtime exception occurs.

    just wondering is any better way to solve this problem (like register an exception handler in @transactional ) instead of running a cron job or somthing else.

    kiwi
    ---
    happay hacking !

  • #2
    You can still catch the exception (outside the transactional method, i so in the calling code, Transaction will still rollback) but you are able to do some work yourself.

    You also might want to look for transactional file system access, there are some frameworks (apache has one also I believe) which can tap into a jta transaction manager.

    Comment


    • #3
      ok thx!

      kiwi
      ----
      happy hacking !

      Comment

      Working...
      X