Results 1 to 3 of 3

Thread: any exception handler for @tranasactional ?

  1. #1

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,630

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    ok thx!

    kiwi
    ----
    happy hacking !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •