db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henning Schmiedehausen (JIRA)" <j...@apache.org>
Subject [jira] Created: (TORQUE-24) Generator doesn't generate data values correctly for BOOLEANCHAR
Date Tue, 30 May 2006 12:58:29 GMT
Generator doesn't generate data values correctly for BOOLEANCHAR
----------------------------------------------------------------

         Key: TORQUE-24
         URL: http://issues.apache.org/jira/browse/TORQUE-24
     Project: Torque
        Type: Bug

  Components: Generator  
    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"
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 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


Mime
View raw message