db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Youngho Cho" <youn...@nannet.co.kr>
Subject Really Strange SQL Exception
Date Fri, 20 Apr 2007 02:38:00 GMT
Hello,

I'm using torque-3.3-RC2 with MySQL 4.1 at Linux.

I got really strange Exception when I execute the method which is in AttachmentTypePeer class

    public static AttachmentType getAttachmentType(String typeName) 
        throws TorqueException
    {
            final Criteria crit = new Criteria();
            crit.add(AttachmentTypePeer.ATTACHMENT_TYPE_NAME, typeName);

            final List list = AttachmentTypePeer.doSelect(crit);
            
            if(list.isEmpty())
            {
                throw new NoRowsException();
            }
            else if(list.size() > 1)
            {
                throw new TooManyRowsException();
            }
              
            return (AttachmentType) list.get(0);
    }



Please refer to the log.

2007-04-20 11:10:42,328 [http-8082-Processor25] DEBUG org.apache.torque.util.SQLBuilder -
SELECT ATTACHMENT_TYPE.ATTACHMENT_TYPE_ID, ATTACHMENT_TYPE.ATTACHMENT_TYPE_NAME, ATTACHMENT_TYPE.SEARCHABLE
FROM ATTACHMENT_TYPE,  WHERE .ATTACHMENT='MODIFICATION'
2007-04-20 11:10:42,328 [http-8082-Processor25] ERROR org.apache.torque.manager.AbstractBaseManager
- 
org.apache.torque.TorqueException: java.sql.SQLException: Syntax error or access violation
message from server: "You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near 'WHERE .ATTACHMENT='MODIFICATION''
at line 1"
 at org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:105)
 at org.apache.torque.util.BasePeer.executeQuery(BasePeer.java:896)
 at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:734)
 at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:707)
 at com.nannet.jettiger.om.BaseAttachmentTypePeer.doSelectVillageRecords(BaseAttachmentTypePeer.java:375)
 at com.nannet.jettiger.om.BaseAttachmentTypePeer.doSelectVillageRecords(BaseAttachmentTypePeer.java:347)
 at com.nannet.jettiger.om.BaseAttachmentTypePeer.doSelect(BaseAttachmentTypePeer.java:316)
 at com.nannet.jettiger.om.AttachmentTypePeer.getAttachmentType(AttachmentTypePeer.java:57)
 at com.nannet.jettiger.om.AttachmentTypeManager.getInstanceByName(AttachmentTypeManager.java:45)


The Schama for the ATTACHMENT_TYPE table is 

<table name="ATTACHMENT_TYPE" idMethod="idbroker" 
    javaName="AttachmentType">
    <column name="ATTACHMENT_TYPE_ID" primaryKey="true" required="true" 
        type="INTEGER" />
    <column name="ATTACHMENT_TYPE_NAME" javaName="Name" required="true" 
        type="VARCHAR" size="255" />    
    <column name="SEARCHABLE" default="0" type="BOOLEANINT" 
        size="1" javaType="primitive"/>
</table>

and there are one foreignTable

<table name="JETTIGER_ATTACHMENT" idMethod="idbroker" javaName="Attachment" >

    <column name="ATTACHMENT_ID" primaryKey="true" required="true" type="BIGINT"></column>
    <column name="ITEM_ID"  type="BIGINT"  required="false" description="item id"></column>
    <column name="ATTACHMENT_TYPE_ID" javaName="TypeId" required="true" type="INTEGER"></column>
   
   . . . .
  
    <index name="IX_ISS_ATTACHTYPE">
        <index-column name="ITEM_ID"/>
        <index-column name="ATTACHMENT_TYPE_ID"/>
    </index>
    <foreign-key foreignTable="ATTACHMENT_TYPE">
        <reference local="ATTACHMENT_TYPE_ID" foreign="ATTACHMENT_TYPE_ID"/>
    </foreign-key>

</table>


Unbeliverble thing is that I have 54 tables in my database and so far there is not any trouble
except this problem !!!.

Is it only for my problem ??


Thanks,

Youngho


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message