hi,

i want to map a simple hierarchy to a java class.

when i try to load the tree object by calling
        SELECT t FROM Tree t WHERE id="0"

following statement (against oracle) will be executed by castor:
        SELECT
"RXS_CASTOR_TREE"."ID","RXS_CASTOR_TREE"."PARENT","RXS_CASTOR_TREE"."ID"
FROM "RXS_CASTOR_TREE" WHERE
"RXS_CASTOR_TREE"."ID"="RXS_CASTOR_TREE"."PARENT"(+) AND
("RXS_CASTOR_TREE"."ID" = ?)

which will fail with:
java.sql.SQLException: ORA-01416: Zwei Tabellen k�nnen nicht durch
gegenseitigen Outer-Join verbunden werden

-> the generated sql seems to be the problem caused by bad mapping rules.

knows somebody the correct mapping ?

regards,

lars

table definition:

        create table rxs_castor_tree
        (
                   id varchar(50),
                   parent     varchar(50)
        )

the mapping:
        <class name="Tree" identity="id">
                <description>simple hierarchy test case</description>
                <map-to table="rxs_castor_tree"/>

                <field name="id" type="string" direct="true">
                        <sql name="id" type="varchar" direct="true"/>
                </field>

                <field name="parent" direct="true" type="Tree">
                        <sql name="parent"/>
                </field>

                <field name="children" direct="true" type="Tree" required="true"
collection="vector">
                  <sql many-key="parent"/>
                </field>
        </class>

the class:
        public class Tree
        {
                public String id;

                public Tree parent;

                public Vector children = new Vector();

                public Tree() {}

                public String toString() { return id; }
        }

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to