Nicholoz,
I don't think it is a very common use case to insert a list in a database. QueryForList returns rows from a select query. Typically, there isn't a need to insert several items into the same table at once. What would you do if you have duplicate items? Would you roll back, stop, or continue?

-Richard

Nicholoz Koka Kiknadze wrote:
/* I apologize for re-posting this, but I think my previous post ended in junk folders because I was using all-numeric mailbox */

Recently I found that I'm writing loops to insert lists of objects way too often. I think it makes sense implementing methods like:

insertList("insertSingleSomeObject",List<SomeObject>) (with "insertSingleSomeObject" beeing sqlmap entry for inserting single object, which I have to use in loops) batchInsert("insertSingleSomeObject",List<SomeObject>) (with batch size configurable like row prefetch is)

updateList("updateSingleSomeObject",List<SomeObject>)
batchUpdate("updateSingleSomeObject",List<SomeObject>)


Think it will make iBatis more consistent: we have queryForList, i.e. getting list of objects in a single line of code, so it's quite natural to expect that one should be able to persist the list in a single call.

Wonder what others think about it.

Nicholoz Koka Kiknadze

Reply via email to