I have just found that castor generates an invalid table alias (in oracle)
for an oql query including a join when the table names in the mapping file
include the schema.  If my mapping file includes
-- snip --
    <class  name="test.User"
            identity="id"
            key-generator="MAX">
        <map-to table="test.user_account"/>
        <field name="id"
               type="long">
            <sql name="id"
                 type="bigint"/>
        </field>
        <field name="code"
               type="string">
            <sql name="code"
                 type="char"/>
        </field>
     </class>
    <class  name="test.UserPermissions"
            identity="id"
            key-generator="MAX">
        <map-to table="test.user_permissions"/>
        <field name="id"
               type="long">
            <sql name="id"
                 type="bigint"/>
        </field>
        <field name="user"
               type="test.User">
            <sql name="user_account_id"/>
        </field>
        <field name="jobGroup"
               type="test.JobGroup">
            <sql name="job_group_id"/>
        </field>
    </class>
-- snip --
The following oql query:
        select  up from test.UserPermissions up
        where up.jobGroup=5
        and up.user.code="fred"
will fail on oracle as the alias ("TEST"."USER_ACCOUNT_0") in the generated
sql query is invalid:
[Castor] SELECT "TEST"."USER_PERMISSIONS"."ID",
"TEST"."USER_PERMISSIONS"."USER_ACCOUNT_ID",
"TEST"."USER_PERMISSIONS"."JOB_GROUP_ID" FROM
"TEST"."USER_PERMISSIONS","TEST"."USER_ACCOUNT" "TEST"."USER_ACCOUNT_0"
WHERE
"TEST"."USER_PERMISSIONS"."TEST_ACCOUNT_ID"="TEST"."USER_ACCOUNT_0"."ID" AND
("TEST"."USER_PERMISSIONS"."JOB_GROUP_ID" = 5 and
"TEST"."USER_ACCOUNT_0"."CODE" = "fred")
Changing the mapping file so that table names are not prefixed by the schema
is an adequate workaround (for us) at the moment.  This occurs with today's
CVS snapshot.
brad
_______________________________ 
brad clow 
chief technical officer 
workingmouse 
email: [EMAIL PROTECTED] 
web: <http://www.workingmouse.com> 

<<attachment: winmail.dat>>

Reply via email to