Apr 22nd, 2008, 01:50 AM
any exception handler for @tranasactional ?
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.
happay hacking !
Apr 22nd, 2008, 02:03 AM
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.
Apr 22nd, 2008, 02:29 AM
happy hacking !