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: If all my sql is in xml, do I gain that much (assuming unit tests) using Mapper objects as well?
Date Wed, 17 Feb 2010 21:09:32 GMT
In my case, it's a bit less code:

Mapper interface:
List<MyObject> getByCompoundKey(@Param("id1") Integer id1,
@Param("id2") Integer id2);

versus

Method in some class:
@SupressWarnings("unchecked")
List<MyObject> getByCompoundKey(Integer id2, Integer id2) {
  Map parms = new HashMap();
  parms.put("id1", id1);
  parms.put("id2", id2);
  return sqlSession.selectList("foo.Bar.getById", parms);
}

YMMV.

Jeff Butler



On Wed, Feb 17, 2010 at 2:36 PM, Rick R <rickcr@gmail.com> wrote:
> On Wed, Feb 17, 2010 at 2:51 PM, Jeff Butler <jeffgbutler@gmail.com> wrote:
>>
>> Using a mapper interface means you have a bit less code to write
>
> How is it less code?, that's my whole point in dropping it since I think it
> adds more code (for in our case seemingly little gain.) All my sql is in xml
> and for every mapper xml statement I create I have to go over and add a
> Mapper interface method. It's just one more piece of code that needs
> attention.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message