I have a strange behavior with a query using criteria and a simple booleanchar column. 
The table is: 
<table name="ITEM" idMethod="idbroker" 
         description="this is the table that contains common information between 
programs and packages: 
                      these are discerned with the help of the 'is_package' field and 
with the participation
                      of the program2package table" >
    <column name="ITEM_ID" required="true" primaryKey="true" autoIncrement="true" 
type="INTEGER"
            description="the id for this item (both program and package)"/>
    ...other columns...
    <column name="IS_PUBLISHED" required="false" type="BOOLEANCHAR" description="if 
true indicates this item is published in the catalog"
            default="Y"/>
    ...other columns...
  </table> 

which is related to the section table:
  <table name="SECTION" idMethod="idbroker" description="this is the table that stores 
information about dynamic sections of the ebismedia catalog site">
     <column name="SECTION_ID" required="true" primaryKey="true" type="INTEGER" 
description="the id for this table"/>
    ...other columns...
  </table

by the table:
  <table name="ITEM_TO_SECTION" idMethod="idbroker" description="this is the table 
that stores information about the programs 
                                                                 that are published in 
a particular section" >
    <column name="ITEM_TO_SECTION_ID" required="true" type="INTEGER" primaryKey="true" 
autoIncrement="true" 
            description="the id for this table" />
    <column name="SECTION_ID" required="true" type="INTEGER" description="the id for 
the section this slot belongs to"/>
    <column name="ITEM_ID" required="true" type="INTEGER" description="the id for the 
item in this slot" />
    ...other columns...
    <foreign-key foreignTable="ITEM" >
      <reference foreign="ITEM_ID" local="ITEM_ID" />
    </foreign-key>
    
   <foreign-key foreignTable="SECTION" >
      <reference foreign="SECTION_ID" local="SECTION_ID" />
    </foreign-key>    
  </table> 

so the column "is_published" is a "booleanchar" one. Well, the following query:
      Criteria programsCriteria = new Criteria();
      programsCriteria.add( ItemPeer.IS_PUBLISHED, true ); // we only load published 
items
      Vector programs = section.getItemToSectionsJoinItem( programsCriteria );

generates the sql code:
SELECT ITEM_TO_SECTION.ITEM_TO_SECTION_ID,ITEM_TO_SECTION.SECTION_ID, 
ITEM_TO_SECTION.ITEM_ID, ITEM_TO_SECTION.POSITION, ITEM_TO_SECTION.FREE_TEXT, 
ITEM_TO_SECTION.VALID_UNTIL, ITEM.ITEM_ID, ITEM.TITLE, ITEM.DESCRIPTION, 
ITEM.DIRECTOR, ITEM.DURATION, ITEM.YEAR, ITEM.TYPE, ITEM.FREE_TEXT, ITEM.IS_PACKAGE, 
ITEM.IS_PUBLISHED, ITEM.HAS_TRAILER, ITEM.IS_NEW, ITEM.VALID_UNTIL FROM 
ITEM_TO_SECTION, ITEM WHERE (ITEM_TO_SECTION.SECTION_ID=100) AND (ITEM.IS_PUBLISHED=1) 
AND ITEM_TO_SECTION.ITEM_ID=ITEM.ITEM_ID

with a numeric 1 in place of the expected "Y". This causes an error in Oracle. 
Is this a bug or I have misspecified something? What can I do?




Reply via email to