db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Αντώνης Λεμπέσης <ant...@di.uoa.gr>
Subject Re: Mapping column types
Date Sun, 25 Dec 2005 17:47:37 GMT
Thoralf Rickert wrote:

>I'm switching currently from Torque 3.1 to 3.2 and have a problem with
>the column type boolean. I'm using MySQL 5.0.16 and the mysql connector
>3.1.12. The table type is InnoDB.
>I've a table which contains a boolean, like this:
><database name="test" defaultIdMethod="native" defaultJavaType="object">
> <table name="test">
>   <column name="id" required="true" type="BIGINT" primaryKey="true"
>   <column name="myBool" required="true" type="BIT" default="0"/>
> </table>
>The generated SQL syntax for the insert-sql task contains this:
>    myBool BIT default 0 NOT NULL,
>    PRIMARY KEY(id)
>) Type=InnoDB ;
>The database accepts this syntax, but when I create a Test object and
>save it to the database the boolean flag is always false. 
>  test = new Test();
>  test.setMybool(new Boolean(false));
>  test.save();
>I'm not sure, if this is a Torque problem, because the BIT feature is
>new to MySQL and there was at least one bug about it, that I've
>reported. But my workaround in Torque 3.1 was it to change the mapping
>from Java objects to MySQL types by editing the db.props in templates.
>There I've changed the BIT to TINYINT and everything was fine.
>Now in Torque 3.2 it seems to me, that this db.props file is no longer
>supported. Is this correct? Why? And what can I do to get Java boolean
>Object but a MySQL tinyint?
>The db.props also contains the table type (here InnoDB) settings. Where
>can I set the table type in Torque 3.2 now?
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org

  I have the exact same problem. After some debugging, I found out that 
the problem lies on the way village translates the output of the jdbc 
driver. The drivers returns an integer for the fields of type bit (1 for 
true, 0 for false). Village obviously (I don't have the source code) 
tries to parse the int value using the method 
Boolean.parseBoolean(int[], int, int), which returns false in either case...
After a brief search, I wasn't able to find the source code and see If I 
could create a simple patch.


To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message