[
https://issues.apache.org/jira/browse/TORQUE-24?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Fox closed TORQUE-24.
----------------------------
> Generator doesn't generate data values correctly for BOOLEANCHAR
> ----------------------------------------------------------------
>
> Key: TORQUE-24
> URL: https://issues.apache.org/jira/browse/TORQUE-24
> Project: Torque
> Issue Type: Improvement
> Components: Generator
> Affects Versions: 3.2
> Environment: MySQL Database, JDK 1.5.0
> Reporter: Henning Schmiedehausen
> Assignee: Thomas Fox
> 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" type="VARCHAR"/>
> <column javaName="login" javaType="object" name="people_login"
> required="true" size="16" type="VARCHAR"/>
> <column javaName="member" javaType="primitive" name="people_member"
> required="true" type="BOOLEANCHAR"/>
> <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, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]