ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: defaultMap: reuse "resultMap" for std CRUD
Date Tue, 13 Sep 2005 20:42:13 GMT
Hey Ron, where is that code in the .net version? I would like to get
this done...

Larry

On 9/13/05, Ron Grabowski <rongrabowski@yahoo.com> wrote:
> The .Net port of ibatis supports a generate tag:
> 
>  <update id="Update" parameterMap="update-generate-params">
>   <generate table="Categories" by="Category_Id"/>
>  </update>
> 
> That will automatically generate a generic:
> 
>  UPDATE Categories SET...
> 
> sql statement. I believe it also supports generating DELETE and SELECT
> statements.
> 
> Perhaps you can look into porting this code to the Java version.
> 
> --- Joachim Hoffmann <j.hoffmann@mine-it.at> wrote:
> 
> > 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