On 10 June 2010 11:26, Michael Jaaka <michael.ja...@googlemail.com> wrote:
> Is there any way to integrate database transaction with Clojure
> transaction?
> It would be nice if operations done in memory and on database would be
> commited atomicly with the end of transaction scope in Clojure.
> Such interface had to be also aware of changes made by concurrent
> transactions, so it would know when to redo changes.
>
> Any thoughts?

Well, you *could* do something like this:

  (defmacro dotrans [trans & body]
    (let [trans# ~trans]
      (try
        (dosync
          (rollback trans#)
          ~...@body)
        (catch Exception e#
          (rollback trans#)
          (throw e#)))
      (commit trans#)))

But I'm uncertain whether this is a good idea or not.

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to