HI Group!
I am attempting to use sql for inserts into H2 db. It works quite
well when inserting a single record, however when I try and map an
insert function over a collection i keep getting an exception saying :
java.lang.Exception: no current database connection
I defined a function, insert-user
(defn users [user1 user2 user3...])
(defn insert-user [u]
;Insert user into db. Need to wrap in transaction.
(let [{uid :user-id, nm :full-name, g :gender} u]
(insert-values
:user
[:userid :fullname :gender ]
(vector uid nm g))))
So when I run
(with-connection db
(transaction
(insert-user (first (users)))))
It works great. However when I attempt to map the insert function
over a collection I get the no current database connection error
(with-connection db
(transaction
(map insert-user users )))
Any thoughts on why this is occurring? What am I missing?
Thanks much in advance
Bassel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
To unsubscribe, reply using "remove me" as the subject.