You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Ling Wang <li...@yahoo.com> on 2005/09/13 03:51:44 UTC
A bug found for IBatis.Net. Can not handle boolean type for MS Access
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
Re: A bug found for IBatis.Net. Can not handle boolean type for MS Access
Posted by Ron Grabowski <ro...@yahoo.com>.
That was the case a release or two ago (for SQL Server at least) but I
thought the current binary download didn't require the :Boolean syntax.
This is a snippet from one of my mapping files. Published is a bool and
is mapped to a Yes/No column.
<isPropertyAvailable property="Published">
AND (Product.Published = #Published#)
</isPropertyAvailable>
--- Roberto R <ro...@gmail.com> wrote:
> You'll have to coax the DataMapper to handle the Access Yes/No field
> by
> specifying "Boolean" either inline or in a parameterMap.
>
> Roberto
>
> On 9/12/05, Ling Wang <li...@yahoo.com> 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
> >
>
Re: A bug found for IBatis.Net. Can not handle boolean type for MS Access
Posted by Roberto R <ro...@gmail.com>.
You'll have to coax the DataMapper to handle the Access Yes/No field by
specifying "Boolean" either inline or in a parameterMap.
Roberto
On 9/12/05, Ling Wang <li...@yahoo.com> 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
>
Re: A bug found for IBatis.Net. Can not handle boolean type for MS Access
Posted by Ling Wang <li...@yahoo.com>.
Thanks a lot, Ron. It is my problem.
Ling
--- Ron Grabowski <ro...@yahoo.com> wrote:
> You're missing a comma:
>
> PER_HEIGHT_M = #HeightInMeters#,
> PER_IS_MALE = #IsMale#
>
> --- Ling Wang <li...@yahoo.com> wrote:
>
> > 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 <ro...@yahoo.com> wrote:
> >
> > > I use IBatisNet, Access, and Yes/No columns
> everyday
> > > without issue.
> > >
> > > Can you post your xml mapping file please.
> > >
> > > Thanks,
> > > Ron
> > >
> > > --- Ling Wang <li...@yahoo.com> 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
> > > >
> > >
>
=== message truncated ===
Re: A bug found for IBatis.Net. Can not handle boolean type for MS Access
Posted by Ron Grabowski <ro...@yahoo.com>.
You're missing a comma:
PER_HEIGHT_M = #HeightInMeters#,
PER_IS_MALE = #IsMale#
--- Ling Wang <li...@yahoo.com> wrote:
> 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 <ro...@yahoo.com> wrote:
>
> > I use IBatisNet, Access, and Yes/No columns everyday
> > without issue.
> >
> > Can you post your xml mapping file please.
> >
> > Thanks,
> > Ron
> >
> > --- Ling Wang <li...@yahoo.com> 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
> > >
> >
> >
>
>
Re: A bug found for IBatis.Net. Can not handle boolean type for MS Access
Posted by Ling Wang <li...@yahoo.com>.
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 <ro...@yahoo.com> wrote:
> I use IBatisNet, Access, and Yes/No columns everyday
> without issue.
>
> Can you post your xml mapping file please.
>
> Thanks,
> Ron
>
> --- Ling Wang <li...@yahoo.com> 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
> >
>
>
Re: A bug found for IBatis.Net. Can not handle boolean type for MS Access
Posted by Ron Grabowski <ro...@yahoo.com>.
I use IBatisNet, Access, and Yes/No columns everyday without issue.
Can you post your xml mapping file please.
Thanks,
Ron
--- Ling Wang <li...@yahoo.com> 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
>