Ron,

Here is the mapping file:

<?xml version="1.0" encoding="utf-8" ?> 

<sqlMap 
        namespace="Person" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

        xsi:noNamespaceSchemaLocation="SqlMap.xsd">

        <!-- XML "behind" document for the People service
class. -->

        <alias>
                <typeAlias alias="Person"
type="iBatisTutorial.Model.Person,
iBatisTutorial.Model" />
        </alias>
        
        <resultMaps>
                <resultMap id="SelectResult" class="Person">
                        <result property="Id" column="PER_ID" />
                        <result property="FirstName"
column="PER_FIRST_NAME" />
                        <result property="LastName" column="PER_LAST_NAME"
/>
                        <result property="BirthDate"
column="PER_BIRTH_DATE" />
                        <result property="WeightInKilograms"
column="PER_WEIGHT_KG" />
                        <result property="HeightInMeters"
column="PER_HEIGHT_M" />
                        <result property="IsMale" column="PER_IS_MALE" />
                </resultMap>
        </resultMaps>
        
        <statements>
        
                <select id="Select" parameterClass="int"
resultMap="SelectResult">
                        select
                        PER_ID,
                        PER_FIRST_NAME,
                        PER_LAST_NAME,
                        PER_BIRTH_DATE,
                        PER_WEIGHT_KG,
                        PER_HEIGHT_M,
                        PER_IS_MALE
                        from PERSON
                        <dynamic prepend="WHERE">
                                <isParameterPresent>
                                        PER_ID = #value#
                                </isParameterPresent>
                        </dynamic>
                </select>

                <insert id="Insert" parameterClass="Person">
                        insert into PERSON 
                                (PER_ID, PER_FIRST_NAME, PER_LAST_NAME,
                                PER_BIRTH_DATE, PER_WEIGHT_KG, PER_HEIGHT_M,
PER_IS_MALE)
                        values 
                                (#Id#, #FirstName#, #LastName#, 
                                #BirthDate#, #WeightInKilograms#,
#HeightInMeters#, #IsMale#)
                </insert>

                <update id="Update" parameterClass="Person">
                        update PERSON set
                                PER_FIRST_NAME = #FirstName#,
                                PER_LAST_NAME = #LastName#, 
                                PER_BIRTH_DATE = #BirthDate#,
                                PER_WEIGHT_KG = #WeightInKilograms#,
                                PER_HEIGHT_M = #HeightInMeters#
                                PER_IS_MALE = #IsMale#
                        where PER_ID = #Id#
    </update>

    <delete id="Delete" parameterClass="int">
                delete from PERSON
        where PER_ID = #value#
    </delete>
    
        </statements>
        
</sqlMap>

and the Person class:

namespace iBatisTutorial.Model
{


        public class Person
        {
                


                private bool _IsMale = true;
                public bool IsMale
                {
                        get { return _IsMale; }
                        set { _IsMale = value; }
                }

                private int _Id;
                public int Id
                {
                        get { return _Id; }
                        set { _Id = value; }
                }

                private string _FirstName;
                public string FirstName
                {
                        get { return _FirstName; }
                        set { _FirstName = value; }
                }

                private string _LastName;
                public string LastName
                {
                        get { return _LastName; }
                        set { _LastName = value; }
                }

                private DateTime _BirthDate = DateTime.Now;
                public DateTime BirthDate
                {
                        get { return _BirthDate; }
                        set { _BirthDate = value; }
                }

                private double _WeightInKilograms;
                public double WeightInKilograms
                {
                        get { return _WeightInKilograms; }
                        set { _WeightInKilograms = value; }
                }

                private double _HeightInMeters;
                public double HeightInMeters
                {
                        get { return _HeightInMeters; }
                        set { _HeightInMeters = value; }
                }

        }
}

--- Ron Grabowski <[EMAIL PROTECTED]> wrote:

> I use IBatisNet, Access, and Yes/No columns everyday
> without issue.
> 
> Can you post your xml mapping file please.
> 
> Thanks,
> Ron
> 
> --- Ling Wang <[EMAIL PROTECTED]> wrote:
> 
> > I downloaded the tutorial and added a boolean
> > (yes/no)field (PER_IS_MALE) to the person table. I
> > also added a bool field to the person class and
> added
> > all the mappings in the personhelper.xml file.
> When I
> > run the application, I am getting the failures:
> > 
> > System.Data.OleDb.OleDbException: Syntax error
> > (missing operator) in query expression '?
> PER_IS_MALE
> > = ?'.
> > 
> > Can someone take a look and confirm it? It should
> only
> > take less than 10 minutes.
> > 
> > Thanks.
> > 
> > Ling
> > 
> 
> 

Reply via email to