title: Need help making MyBatis work with a terrible database design
body: <p>So i'm working on a project (JSF2, Spring3 Core, MVC, Webflow, MyBatis3, RichFaces, and a legacy Oracle 10g).  The source of all of my trouble's has to do with the design of the database.  The problem is that the majority of the DB tables have changing schema (bad design perhaps?). So I need to be able to support the addition &amp; removal of extra columns.</p>
  
  <p>To accommodate this i've made MyBatis pull data into a custom "universal" domain object which basically just extends a hashmap.  My current issue is updating these hashmap objects.  There should be a way to make it work, but I can seem to get MyBatis to co-operate.  I've tried using HashMap.entrySet() &amp; MyBatis's , but to no avail. eg.</p>
  
  <pre><code>UPDATE MYTABLE
  SET 
  &lt;foreach collection="entries" index="i" item="entry" close=""  open="" separator=", "&gt;
    #{entry.key} = #{entry.value}
  &lt;/foreach&gt;
  WHERE FOO='BAR';
  </code></pre>
  
  <p>I've tried a custom TypeHandler but setParameter() doesn't give me enough access to do what I need. A ResultHandler didn't give me enough access to each individual result, so I couldn't use that either. </p>
  
  <p>Now I know i could do something like Obj.createUpdateSqlString() and insert it into the mapper as a literal string, but thats a bit of a hack and leaves me open to SQL injection.  Not to mention that would involve escaping a lot of strings, and accounting for a wide range of possible input, and unless all possibilities are covered that opens up the door for some serious bugs.</p>
  
  <p>So is there an established way to do this? Or atleast a halfway decent way? I've heard a number of hardcore MyBatis advocates say they've yet to encounter a situation MyBatis couldn't handle gracefully; so MyBatis experts, please help me out!!</p>