I you use a parameterMap, then you must use ? markers in your SQL.

The best thing to do is delete your parameter map and specify
parameterClass=EmployeeParticipants on your <select>.  It will likely start
working with that change.

I recommend NEVER using <parameterMap>.

Jeff Butler

On Tue, Jun 2, 2009 at 2:27 PM, sanjeev40084 <sanjeev40...@hotmail.com>wrote:

>
> I am having problem with the sql inside my sqlMap, could anyone help me fix
> it.
>
> I have a class to map parameters:
>
> EmployeeParticipants
>
>  public class EmployeeParticipants
>
>  {
>        public string EmployeeID { get; set; }
>        public int Year              { get; set; }
>        public string StartDate   { get; set; }
>        public string EndDate     { get; set; }
>
>        public ParticipantParameters(string employeeID, int Year)
>        {
>            EmployeeID = employeeID;
>            Year = Year;
>            StartDate = "1/1/" + Year.ToString();
>            EndDate = "1/1/" + (Year + 1).ToString();
>        }
>    }
>
>
> My sqlMap.xml looks like this,
>
> <alias>
>                <typeAlias alias="ParticipantParameters"
> type="Quad.QuadMed.QMedAwardPayoutCalculator.Domain.ParticipantParameters,
> QMedAwardPayoutCalculator.Domain"/>
>        </alias>
>
>        <parameterMaps>
>                <parameterMap id ="EmployeeParameters"
> class="EmployeeParticipants">
>                        <parameter property ="EmployeeID"
> column="employeeID"/>
>                        <parameter property="StartDate"
>  column="startDate"/>
>                </parameterMap>
>        </parameterMaps>
>
>        <statements>
>                <select id="GetEmployeeCount"
>                        parameterMap="EmployeeParameters"
>                        resultClass="int">
>                        SELECT count(PT.EMPLID) as CourseCount
>                        FROM db1..tb1
>                        INNER JOIN db1..tb2 ON tb1.ID = tb2.ID
>                        WHERE tb1.FN = 'S'
>                        AND tb1.LN     = 'N'
>                        AND tb1.DATE > #startDate#         <--i think the
> issue exists here
>                        AND tb1.ID     = #employeeID#       <--DATE and ID
> are in string   datatype
>                </select>
>        </statements>
> --
> View this message in context:
> http://www.nabble.com/sql-in-sqlMap-tp23839118p23839118.html
> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>
>

Reply via email to