Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Rolling back transactions
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
edoloughlin  
View profile  
 More options Nov 30 2010, 6:19 pm
From: edoloughlin <ed.olough...@gmail.com>
Date: Tue, 30 Nov 2010 15:19:53 -0800 (PST)
Local: Tues, Nov 30 2010 6:19 pm
Subject: Rolling back transactions
Hi all,

I'm trying to use clj-record.core/transaction to rollback based on
some logic.

I don't want to throw exceptions directly, as I'm using ring and it
works nicely with clojure.contrib.condition/raise. However, a clj-
record transaction seems to ignore this and my transacitons don't get
rolled back. If I use (clojure.contrib.sql/set-rollback-only) then my
transaction does get rolled back but I get an ugly exception thrown:

java.lang.Exception: transaction rolled back: null
        at clojure.contrib.sql.internal$throw_rollback.invoke(internal.clj:
142)
        at clojure.contrib.sql.internal$transaction_STAR_.invoke(internal.clj:
169)
        [... my  code]

Any advice as to how I might cleanly roll back without mixing Java
exceptions and clojure.contrib.condition's?

Thanks,
Ed O'Loughlin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shantanu Kumar  
View profile  
 More options Dec 1 2010, 9:43 am
From: Shantanu Kumar <kumar.shant...@gmail.com>
Date: Wed, 1 Dec 2010 06:43:51 -0800 (PST)
Local: Wed, Dec 1 2010 9:43 am
Subject: Re: Rolling back transactions
Do either of these help?

http://bitumenframework.blogspot.com/2010/11/non-breaking-error-handl...

http://clojuredocs.org/clojure_contrib/clojure.contrib.condition/hand...

Regards,
Shantanu

On Dec 1, 4:19 am, edoloughlin <ed.olough...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John D. Hume  
View profile  
 More options Dec 1 2010, 11:07 am
From: "John D. Hume" <duelin.mark...@gmail.com>
Date: Wed, 1 Dec 2010 11:07:11 -0500
Local: Wed, Dec 1 2010 11:07 am
Subject: Re: [clj-record-dev] Rolling back transactions

I don't have any suggestions off-hand, but do let the list know if you see a
change that could be made to clj-record that would make this cleaner.

-- typed with my thumbs
On Nov 30, 2010 6:19 PM, "edoloughlin" <ed.olough...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
edoloughlin  
View profile  
 More options Dec 30 2010, 4:05 pm
From: edoloughlin <ed.olough...@gmail.com>
Date: Thu, 30 Dec 2010 13:05:58 -0800 (PST)
Local: Thurs, Dec 30 2010 4:05 pm
Subject: Re: Rolling back transactions
I implemented something similar to contrib.sql/transaction and
contrib.sql/set-rollback to cause a condition to be raised. The code's
at https://gist.github.com/760295

Call rollback-with-raise within a transaction body to cause a
condition to be raised with a specific error code. I haven't included
my.util.error/raise-with-message as it does some error text lookup
specific to my app but it's simple to implement.

On Dec 1, 4:07 pm, "John D. Hume" <duelin.mark...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »