ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Inserting lists
Date Fri, 30 May 2008 12:11:43 GMT
It is a trivial matter to write these methods yourself - you could
even write a utility method one time and be done with it:

insertList(String statementId, List<Object> records) {
  for (Object record : records) {
    sqlMap.insert(statementId, record);

The question is - how do you want to handle transactions?  Is it all
one transaction, or is it individual transactions?  This is a user
decision - not a decision iBATIS should make for you.

So, my opinion is that we should not do this in iBATIS.  iBATIS wraps
JDBC and SQL, this would be more of an application level thing.

Jeff Butler

On Thu, May 29, 2008 at 4:44 PM, Nicholoz Koka Kiknadze
<kiknadze@gmail.com> 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

View raw message