Hi Kent,

I also had some problems with booleans with PostgreSQL. This was my email and my problem:

Hi everybody,

I'm using iBatis under .NET and PostgreSQL (ODBC driver). I'm trying my first 
mappings and I have a problem with the boolean datatype.

Integer mapping is working okay, and I can query / insert objects without any 
trouble, but the problem arises when one of the attributes is a boolean (bool 
under .NET / bool under PostgreSQL).

When I insert an object there is no problem, but when I query the database to 
populate an object, the following exception arises:

"Uncontrolled Exception: System.InvalidCastException: "Specified conversion is not 
valid" (at System.Data.Odbc.OdbcDataReader.GetBoolean(Int32 i)


I don't know what the problem is, cause I'm using bool types under .Net and under PostgreSQL. I also tried the bit type (in the documentation), but it doesn't work.

What annoys me is that insertions are correct, but queries are not.

I tried several solutions (specifying a dbtype = 'bool' in the resultMap property, for example) but none of them worked, so now I'm using shorts even it's still spring ;) (bad joke)


Talking seriously, I know using a short type instead is messy and not elegant, in fact it annoys me quite a lot, but it's the only one that did work.

I hope you're luckier. Just keep in touch if you come across something.

See you,

Pablo.




Reply via email to