You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by "Hay, Markus" <ma...@secureinfo.com> on 2006/03/09 23:55:22 UTC

Error using Oracle + Torque 3.1 (ORA-00923)

Hello.

We're using Torque 3.1 with our application and the following
TorqueException is being thrown when we are importing application
content into the database (note that everything works fine when using
MSSQL):

[Stack_Trace] = 
org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:236)
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:730)
com.secureinfo.flatties.om.BaseImagePeer.doInsert(BaseImagePeer.java:239
)
com.secureinfo.flatties.om.BaseImagePeer.doInsert(BaseImagePeer.java:601
)
com.secureinfo.flatties.om.BaseImage.save(BaseImage.java:644)
com.secureinfo.baboon.export.db.ObjectInjector.injectPrimaryObject(Objec
tInjector.java:628)
com.secureinfo.baboon.export.db.ObjectInjector.inject(ObjectInjector.jav
a:390)
com.secureinfo.baboon.export.xml.DBImporter.importXML(DBImporter.java:45
0)
com.secureinfo.baboon.export.xml.DBImporter.injectClasses(DBImporter.jav
a:337)
com.secureinfo.baboon.export.xml.DBImporter.runImport(DBImporter.java:24
7)
com.secureinfo.baboon.export.ui.ContentAdminFramework.performImport(Cont
entAdminFramework.java:596)
com.secureinfo.baboon.export.ui.ContentAdminFramework.prepImport(Content
AdminFramework.java:525)
com.secureinfo.baboon.export.ui.ContentAdminFramework.locateData(Content
AdminFramework.java:298)
com.secureinfo.baboon.export.ui.ContentAdminFramework.postTaskConfig(Con
tentAdminFramework.java:247)
com.secureinfo.baboon.export.ui.ContentAdminFramework.doRun(ContentAdmin
Framework.java:175)
com.secureinfo.baboon.export.ui.ContentAdminFramework.run(ContentAdminFr
amework.java:114)
com.secureinfo.baboon.export.ui.DBMain.invoke(DBMain.java:157)
com.secureinfo.baboon.export.ui.DBMain.main(DBMain.java:262)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
BootStrapContent.main(BootStrapContent.java:54)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.zerog.lax.LAX.launch(DashoA8113)
com.zerog.lax.LAX.main(DashoA8113)
org.apache.torque.TorqueException: ORA-00923: FROM keyword not found
where expected


** The following is what we are using in our Torque XML file that
generates the classes (for the particluar table that is causing the
above error):
<table name="IMAGE" idMethod="native">
        <column primaryKey="true" required="true" type="INTEGER"
name="IMAGE_ID"/>
        <column type="BINARY" name="DATA"/>
        <column type="DATE" name="MODIFIED_DATE"/>
        <column type="VARCHAR" name="MODIFIED_USER_NAME"/>
        <column type="VARCHAR" name="MODIFIED_DOMAIN_NAME"/>
        <column type="INTEGER" javaType="object" name="FLAVOR_ID"/>
        <column type="VARCHAR" name="GUID"/>
        <column type="BIT" javaType="object" name="DEPRECATED"/>
        <column type="INTEGER" javaType="object" name="DEPRECATED_BY"/>
        <column type="CHAR" name="image_hash"/>
        <column type="VARCHAR" name="image_name"/>
</table>

** The table is created as follows (through various scripts during the
installation process):
CREATE TABLE IMAGE (
	IMAGE_ID INT NOT NULL,
	DATA BLOB NULL,
	MODIFIED_DATE TIMESTAMP NULL,
	MODIFIED_USER_NAME VARCHAR2 (50) NULL,
	MODIFIED_DOMAIN_NAME VARCHAR2 (50) NULL,
	FLAVOR_ID INT NULL,
	GUID VARCHAR2 (256) NULL,
	DEPRECATED SMALLINT NULL,
	DEPRECATED_BY INT NULL,
	image_hash	char(32) null,
	image_name	varchar(50) null
)

ALTER TABLE IMAGE ADD CONSTRAINT XK_IMAGE PRIMARY KEY  (IMAGE_ID);

CREATE SEQUENCE SEQ_IMAGE START WITH 1 INCREMENT BY 1;

CREATE OR REPLACE TRIGGER IMAGE_IDENTITY
BEFORE INSERT ON "IMAGE" FOR EACH ROW
BEGIN
  IF :NEW.IMAGE_ID IS NULL THEN
    SELECT NVL(:NEW.IMAGE_ID, SEQ_IMAGE.NEXTVAL)
    INTO   :NEW.IMAGE_ID
    FROM   DUAL;
  END IF;
END;

--------

Does anyone know what the problem is and how I might fix it? I've
searched around but haven't run into a solution for this. Is this an
issue with Torque or does something need to change on our end? Thanks in
advance.

Markus F. Hay
Configuration Manager

RE: Error using Oracle + Torque 3.1 (ORA-00923)

Posted by Thomas Fischer <fi...@seitenbau.net>.
A few things come to my mind:
- It would be most helpful if the offending SQL statement would be known.
You can e.g. use P6Spy to print out the sql statements issued by Torque.
See
http://wiki.apache.org/db-torque/FrequentlyAskedQuestions#head-46f663e01bea72682fdc5f60ae02f2a47de29fec

Only if this does not help:
- You have got a blob in your table. Blobs in oracle are not supported in
the data access layer which is used by torque (village). There is a custom
village library available for oracle, read the oracle howto on the Torque
homepage.
- I am not so sure with Torque 3.1, but looking at the trigger code, it
does not seem to be generated by torque this way. This might also cause the
problem. Which IdMethod are you using ?

   Thomas

"Hay, Markus" <ma...@secureinfo.com> schrieb am 09.03.2006 23:55:22:

> Hello.
>
> We're using Torque 3.1 with our application and the following
> TorqueException is being thrown when we are importing application
> content into the database (note that everything works fine when using
> MSSQL):
>
> [Stack_Trace] =
> org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:236)
> org.apache.torque.util.BasePeer.doInsert(BasePeer.java:730)
> com.secureinfo.flatties.om.BaseImagePeer.doInsert(BaseImagePeer.java:239
> )
> com.secureinfo.flatties.om.BaseImagePeer.doInsert(BaseImagePeer.java:601
> )
> com.secureinfo.flatties.om.BaseImage.save(BaseImage.java:644)
> com.secureinfo.baboon.export.db.ObjectInjector.injectPrimaryObject(Objec
> tInjector.java:628)
> com.secureinfo.baboon.export.db.ObjectInjector.inject(ObjectInjector.jav
> a:390)
> com.secureinfo.baboon.export.xml.DBImporter.importXML(DBImporter.java:45
> 0)
> com.secureinfo.baboon.export.xml.DBImporter.injectClasses(DBImporter.jav
> a:337)
> com.secureinfo.baboon.export.xml.DBImporter.runImport(DBImporter.java:24
> 7)
> com.secureinfo.baboon.export.ui.ContentAdminFramework.performImport(Cont
> entAdminFramework.java:596)
> com.secureinfo.baboon.export.ui.ContentAdminFramework.prepImport(Content
> AdminFramework.java:525)
> com.secureinfo.baboon.export.ui.ContentAdminFramework.locateData(Content
> AdminFramework.java:298)
> com.secureinfo.baboon.export.ui.ContentAdminFramework.postTaskConfig(Con
> tentAdminFramework.java:247)
> com.secureinfo.baboon.export.ui.ContentAdminFramework.doRun(ContentAdmin
> Framework.java:175)
> com.secureinfo.baboon.export.ui.ContentAdminFramework.run(ContentAdminFr
> amework.java:114)
> com.secureinfo.baboon.export.ui.DBMain.invoke(DBMain.java:157)
> com.secureinfo.baboon.export.ui.DBMain.main(DBMain.java:262)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> java.lang.reflect.Method.invoke(Unknown Source)
> BootStrapContent.main(BootStrapContent.java:54)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> java.lang.reflect.Method.invoke(Unknown Source)
> com.zerog.lax.LAX.launch(DashoA8113)
> com.zerog.lax.LAX.main(DashoA8113)
> org.apache.torque.TorqueException: ORA-00923: FROM keyword not found
> where expected
>
>
> ** The following is what we are using in our Torque XML file that
> generates the classes (for the particluar table that is causing the
> above error):
> <table name="IMAGE" idMethod="native">
>         <column primaryKey="true" required="true" type="INTEGER"
> name="IMAGE_ID"/>
>         <column type="BINARY" name="DATA"/>
>         <column type="DATE" name="MODIFIED_DATE"/>
>         <column type="VARCHAR" name="MODIFIED_USER_NAME"/>
>         <column type="VARCHAR" name="MODIFIED_DOMAIN_NAME"/>
>         <column type="INTEGER" javaType="object" name="FLAVOR_ID"/>
>         <column type="VARCHAR" name="GUID"/>
>         <column type="BIT" javaType="object" name="DEPRECATED"/>
>         <column type="INTEGER" javaType="object" name="DEPRECATED_BY"/>
>         <column type="CHAR" name="image_hash"/>
>         <column type="VARCHAR" name="image_name"/>
> </table>
>
> ** The table is created as follows (through various scripts during the
> installation process):
> CREATE TABLE IMAGE (
>    IMAGE_ID INT NOT NULL,
>    DATA BLOB NULL,
>    MODIFIED_DATE TIMESTAMP NULL,
>    MODIFIED_USER_NAME VARCHAR2 (50) NULL,
>    MODIFIED_DOMAIN_NAME VARCHAR2 (50) NULL,
>    FLAVOR_ID INT NULL,
>    GUID VARCHAR2 (256) NULL,
>    DEPRECATED SMALLINT NULL,
>    DEPRECATED_BY INT NULL,
>    image_hash   char(32) null,
>    image_name   varchar(50) null
> )
>
> ALTER TABLE IMAGE ADD CONSTRAINT XK_IMAGE PRIMARY KEY  (IMAGE_ID);
>
> CREATE SEQUENCE SEQ_IMAGE START WITH 1 INCREMENT BY 1;
>
> CREATE OR REPLACE TRIGGER IMAGE_IDENTITY
> BEFORE INSERT ON "IMAGE" FOR EACH ROW
> BEGIN
>   IF :NEW.IMAGE_ID IS NULL THEN
>     SELECT NVL(:NEW.IMAGE_ID, SEQ_IMAGE.NEXTVAL)
>     INTO   :NEW.IMAGE_ID
>     FROM   DUAL;
>   END IF;
> END;
>
> --------
>
> Does anyone know what the problem is and how I might fix it? I've
> searched around but haven't run into a solution for this. Is this an
> issue with Torque or does something need to change on our end? Thanks in
> advance.
>
> Markus F. Hay
> Configuration Manager


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