ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles Bayon" <ibatis....@gmail.com>
Subject Re: Profiling Prepared Statements
Date Wed, 06 Feb 2008 21:31:30 GMT
Why don't you put your comment in the mappping file

    <statement id="DynamicJIRA168"
                    parameterClass="Query"
                    resultClass="Account">
      */* DynamicJIRA168*/*
      select
      Account_ID            as Id,
      Account_FirstName    as FirstName,
      Account_LastName    as LastName,
      Account_Email        as EmailAddress
      from Accounts
      <dynamic prepend="where">
        <isParameterPresent>
          <isNotEmpty prepend="and" property="DataObject.Id" >
            Account_ID = #DataObject.Id#
          </isNotEmpty>
          <isNotEmpty prepend="and" property="DataObject.FirstName" >
            Account_FirstName = #DataObject.FirstName#
          </isNotEmpty>
          <isNotEmpty prepend="and" property="DataObject.LastName"  >
            Account_LastName = #DataObject.LastName#
          </isNotEmpty>
        </isParameterPresent>
      </dynamic>
    </statement>

 you will in the trace no ?
2008/02/06 22:29:45:SSS [DEBUG]
Apache.Ibatis.DataMapper.Model.Statements.PreparedStatementFactory -
Statement Id: [DynamicJIRA168] Prepared SQL: [*/* DynamicJIRA168*/ *
select        Account_ID   as Id,        Account_FirstName as
FirstName,        Account_LastName as LastName,        Account_Email  as
EmailAddress        from Accounts where   Account_ID =  @param0]

-- 
Cheers,
Gilles

Mime
View raw message