ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joachim Hoffmann <j.hoffm...@mine-it.at>
Subject defaultMap: reuse "resultMap" for std CRUD
Date Tue, 13 Sep 2005 14:37:49 GMT
My primary objective to have a look at iBatis was  to type less for 
sql-jdbc-object mappings.
Therefore...
I wonder if it would possible in iBatis to define a default mapping, 
e.g. <defaultMap>,
which in turn could be reused for implicitly defined, standard instances 
of  insert/update/delete?

As far as I understood from the manuals there is a similar  feature for
<statement ... resultMap= ... > SELECT * FROM table </statement>

This would avoid that you have to re-type parts of the mapping inside 
the SQL statements
for insert, update, delete.

e.g.
<defaultMap id="dmAccountObject" ...>
     ... defined like resultMap, first Attribute is ObjID/PKey, etc. ...
</defaultMap>

<update>  id="defaultUpdate" defaultMap="dmAccountObject> </update>

instead of

<update id="updateAccount" parameterClass="account">
    update ACCOUNT set LANGPREF = #languagePreference#, FAVCATEGORY = 
#favouriteCategoryId#,
    MYLISTOPT = #listOption#, BANNEROPT = #bannerOption# where USERID = 
#username#
 </update>


Kind Regards,
JoHo


Mime
View raw message