On Wed, Jul 20, 2011 at 7:18 AM, Shantanu Kumar
<kumar.shant...@gmail.com> wrote:
> JDBC Batch-insert is not supposed to return a list of generated keys.

There may be multiple autogenerated keys in a single row - not common,
I suspect, but possible. So normally with c.j.j, you'll get back a
sequence with a single generated key in it but that sequence _could_
have more numbers if you have multiple autogenerated keys (assuming
you're working with a database that supports that).

> It is possible to implement batch-insert as a series of individual
> insert statements, so that you can collect the generated key after
> each operation and eventually return a collection of generated keys.

Note that some databases just plain ol' don't support
RETURN_GENERATED_KEYS (like HSQLDB) and in other situations, you can
either insert-record for each row to get back key(s) or batch insert
and know you won't get keys back. c.j.j only attempts to return keys
if you do something that inserts a single row, assuming that if you
want to insert multiple rows, you're deliberately doing that to take
advantage of the performance increase of a single insert statement.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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