Results 1 to 2 of 2

Thread: Commons Transaction

  1. #1

    Default Commons Transaction

    Has anyone used the newly promoted Commons Transaction for dealing with file writing/reading in a transaction setting? I have a few service methods that write or delete a file then stick the file name into a database. I have rollback working great for database exceptions where it can't write the filename, but I have no ability to delete the file if there is a failure writing its name to the database. Is there a built in spring mechanism for this or should I pursue creating a type of transaction aspect thing with this commons Transaction?

  2. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    For this specific usecase, you can create a org.springframework.aop.ThrowsAdvice and hook it as a preInterceptor into your TransactionProxyFactoryBean. The advice should be responsable for files deletion if a DataAccessException / MyApplicationException is thrown.
    HTH
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

Similar Threads

  1. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  2. Replies: 0
    Last Post: Jun 6th, 2005, 06:22 AM
  3. Replies: 3
    Last Post: May 16th, 2005, 07:04 AM
  4. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  5. Transaction pb Hibernate/MySQL
    By syluser in forum Data
    Replies: 2
    Last Post: Aug 28th, 2004, 02:40 PM

Posting Permissions

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