db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fischer (JIRA)" <j...@apache.org>
Subject [jira] Commented: (TORQUE-24) Generator doesn't generate data values correctly for BOOLEANCHAR
Date Sat, 15 Jul 2006 08:26:14 GMT
    [ http://issues.apache.org/jira/browse/TORQUE-24?page=comments#action_12421300 ] 
Thomas Fischer commented on TORQUE-24:

If one would put "Y" and "N" instead of "true" and "false" in the data-xml, everything would
work as expected, so the problem is rather that this is counterintuitive if one does not know
the internals of booleanchar.

So I would regard this isue as an enhancement rather than a bug. 

> Generator doesn't generate data values correctly for BOOLEANCHAR
> ----------------------------------------------------------------
>                 Key: TORQUE-24
>                 URL: http://issues.apache.org/jira/browse/TORQUE-24
>             Project: Torque
>          Issue Type: Bug
>          Components: Generator
>    Affects Versions: 3.2
>         Environment: MySQL Database, JDK 1.5.0
>            Reporter: Henning Schmiedehausen
>            Priority: Minor
> Consider the following table description:
> <table name="people">
>   <column javaName="firstName" javaType="object" name="people_firstname" required="false"
size="32" type="VARCHAR"/>
>   <column javaName="name" javaType="object" name="people_name" required="true" size="32"
>   <column javaName="login" javaType="object" name="people_login" required="true" size="16"
>   <column javaName="member" javaType="primitive" name="people_member" required="true"
>   <column javaName="id" javaType="object" name="people_id" type="BIGINT" primaryKey="true"
required="true" autoIncrement="true" />
> </table>
> And the following people-data.xml file:
> <dataset name="all">
>   <People Name="Doe" FirstName="John" Member="true" Login="jdoe"/>
>   <People Name="User" FirstName="Joe" Member="false" Login="juser"/>
>   <People Name="Spot the Dog" Member="false" Login="spot"/>
> </dataset>
> Running ant -f build-torque.xml datasql creates:
> INSERT INTO people (people_name,people_firstname,people_member,people_login)
>     VALUES ('Doe','John',true,'jdoe');
> INSERT INTO people (people_name,people_firstname,people_member,people_login)
>     VALUES ('User','Joe',false,'juser');
> which end up as '1' and '0' in the people_member column. However the BOOLEANCHAR Definition
expects 'Y' and 'N', so using a boolean criteria does not work because both values in the
boolean column (1 and 0) are interpreted correctly. WIth the example above and a booleanchar
column, you will get
>         Criteria crit = new Criteria();
>         crit.add(PeoplePeer.PEOPLE_MEMBER, true);
>         PeoplePeer.doSelect(crit).size() == 0
>         Criteria crit = new Criteria();
>         crit.add(PeoplePeer.PEOPLE_MEMBER, false);
>         PeoplePeer.doSelect(crit).size() == 0
> which is fun, considering the fact that there are three rows and the column is not-null...
> The generator should use 'Y' and 'N' for BOOLEANCHAR columns. 

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


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

View raw message