You need to create a User object that contains a collection of Person
objects such that in Java you could call

        someUser.getPersons()  ------ returns ---> a
java.util.Collection of Person objects

You'll need to create the relevant entries and foreign key references in
your mapping file

        <class name="com....User" identity="id">
                <cache-type type="none"/>
                <map-to table="user" xml="user"/>
                <field name="id" type="long">
                        <sql name="userid" type="bigint"/>
                        <bind-xml name="id" node="attribute"/>
                </field>
                <field name="persons" type="com...Person"
collection="arraylist">
                        <sql many-key="userid"/>
                        <bind-xml name="person" node="element"/>
                </field>
        </class>


Once that is working You can then execute the following OQL:

        oqlquery = db.getOQLQuery("select usr from com...User usr where
usr.persons.id = $1");
        oqlquery.bind( somePerson.getId() );

Hope it helps,
Ijonas.



-----Original Message-----
From: Knut Herhold [mailto:knut.herhold@;sourcepark.de] 
Sent: 17 October 2002 12:21
To: [EMAIL PROTECTED]
Subject: [castor-dev] incorrect token type, why ???


hi,

when i use this query

==========================================================
"SELECT usr FROM com.xxxxxxxx.access.Person prs,
com.xxxxxxxx.access.User usr WHERE prs.id = usr.personId"
==========================================================

i get the message

=====================================================================
org.exolab.castor.jdo.oql.OQLSyntaxException: An incorrect token type
was found near , (45, need 0
=====================================================================

Is the syntax incorrect
How can i use this query.

please help me

Thanks

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

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

Reply via email to