Hello again,

please excuse my 2nd posting of the same problem, it'll be the last time.

I just have absolutely no idea, what's the problem here and would really
appreciate at least a comment like "read the f.. page ..." or 
"you silly! why don't you just..." or "query for xxx in the archive"!

What could possibly be the problem or where could I search for the problem
of Castor using a query-given primary key's value for separate tables?

Thank you very much!
Kind Regards
Frank Bruch

P.S.: In fact this may represent the biggest problem I have with Castor: If
anything
goes wrong when a network of related objects is loaded after a query
I just receive null for the result object and get no message about the
failure.
(e.g.: a foreign key's value points to an unexistant row and for some
certain reason there's no database-constraint which prevents this)

--- Weitergeleitete Nachricht / Forwarded Message ---
Date: Thu, 8 Apr 2004 21:04:34 +0200 (MEST)
From: "Frank Bruch" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [castor-dev] Castor uses query-value for table x as key for table
y, too


Hello there,

using Castor 0.9.5.3 (reproducable with 0.9.4.3 also) I experience a problem
of Castor using
a primary key's value for table X to read rows from table Y, too. My
OQL-query:

        Select b from ServiceImplementationVO b where b.oid=2017

Using p6spy 1.3 I was able to log the sql. What follows are the first two
sql-statements 
executed after giving the above OQL to castor. Please ignore the attributes
and have a look
at the end of the
where-clauses.

        SELECT
"SERVICEIMPLEMENTATION"."ID","SERVICEIMPLEMENTATION"."SERVICEID","SERVICEIMPLEMENTATION"."VERSIONMAJOR","SERVICEIMPLEMENTATION"."VERSIONMINOR",
        
"SERVICEIMPLEMENTATION"."VERSIONPATCH","SERVICEIMPLEMENTATION"."LIFECYCLESTATUSDATE","SERVICEIMPLEMENTATION"."SERVICEREQUESTDATE","SERVICEIMPLEMENTATION"."PUBLICITY",
        
"SERVICEIMPLEMENTATION"."LOCALEID","SERVICEIMPLEMENTATION"."DESCRIPTION","SERVICEIMPLEMENTATION"."LIFECYCLESTATE","SERVICEIMPLEMENTATION"."SERVICETYPE",
        
"SERVICEIMPLEMENTATION"."ENVIRONMENT","SERVICEIMPLEMENTATION"."MIGRATIONASPECT","ATTRIBUTEVALUE"."ID","LINK"."ID","MAP_INCIDENTS_SERVICES"."KEY_INCIDENTS",
        
"SERVICEIMPLEMENTATION"."INTERFACEOID","MAP_PACKAGEVERSION_SERVICEIMPL"."KEY_PACKAGEVERSION","CONSUMERPROVIDER"."ID","SERVICEIMPLEMENTATION"."ORIGINOID","MAPPING"."ID"
        FROM
"CONSUMERPROVIDER","MAPPING","MAP_INCIDENTS_SERVICES","LINK","MAP_PACKAGEVERSION_SERVICEIMPL","ATTRIBUTEVALUE","SERVICEIMPLEMENTATION"
        WHERE
"SERVICEIMPLEMENTATION"."ID"="ATTRIBUTEVALUE"."SERVICEIMPLEMENTATIONOID"(+) 
        AND "SERVICEIMPLEMENTATION"."ID"="LINK"."SERVICEIMPLEMENTATIONOID"(+) 
        AND
"SERVICEIMPLEMENTATION"."ID"="MAP_INCIDENTS_SERVICES"."KEY_SERVICES"(+)

        AND
"SERVICEIMPLEMENTATION"."ID"="MAP_PACKAGEVERSION_SERVICEIMPL"."KEY_SERVICEIMPLEMENTATION"(+)
        AND
"SERVICEIMPLEMENTATION"."ID"="CONSUMERPROVIDER"."SERVICEIMPLEMENTATIONOID"(+)
        AND "SERVICEIMPLEMENTATION"."ID"="MAPPING"."SERVICEIMPLEMENTATIONOID"(+) 
        AND ("SERVICEIMPLEMENTATION"."ID" =
2017);

        SELECT
"ATTRIBUTEVALUE"."VALUE","ATTRIBUTEVALUE"."COMPLEXTYPEOID","ATTRIBUTEVALUE"."FIELDOID","ATTRIBUTEVALUE"."SERVICEINTERFACEOID",
        
"ATTRIBUTEVALUE"."ATTRIBUTEDEFINITIONOID","ATTRIBUTEVALUE"."SERVICEIMPLEMENTATIONOID","ATTRIBUTEVALUE"."WEBCOMPONENTOID","ATTRIBUTEVALUE"."SCREENFIELDCONTAINEROID",
        
"ATTRIBUTEVALUE"."IMPLFORMATOID","ATTRIBUTEVALUE"."MAPPINGOID","ATTRIBUTEVALUE"."GUIDEFINITIONOID","ATTRIBUTEVALUE"."SCREENOID","ATTRIBUTEVALUE"."SCREENFIELDOID",
        
"ATTRIBUTEVALUE"."EVENTSOURCEOID","ATTRIBUTEVALUE"."PARAMETEROID","ATTRIBUTEVALUE"."SCREENFORMOID"
        FROM "ATTRIBUTEVALUE" 
        WHERE "ATTRIBUTEVALUE"."ID"='2017';

While the first query is correctly constructed with the id 2017, the second
is not, because 2017 is the id for the serviceimplementation-table
but of course not for the attributevalue-table. I would have expected the
query to be as follows

        select ... from attributevalue where
attributevalue.serviceimplementationoid=serviceimplementation.id

Below the relevant parts of the mapping (attributes omitted).

    <class name="AttributeValueVO" identity="oid">
        <map-to table="attributevalue"/>
        <field name="oid" type="long" required="true"> <sql name="id"
type="bigint"/> </field>
        <field name="attributesN1ServiceImplementation"
type="ServiceImplementationVO">
            <sql name="serviceimplementationoid"/>
        </field>
    </class>

    <class name="ServiceImplementationVO" identity="oid">
        <map-to table="serviceimplementation"/>
        <field name="oid" type="long" required="true"> <sql name="id"
type="bigint"/> </field>
        <field name="attributes" type="AttributeValueVO"
collection="collection">
            <sql many-key="serviceimplementationoid"/>
        </field>
    </class>

I hope, I am not too stupid but can anyone tell me what could possibly be
wrong here?
(In fact I haven't changed anything in this part since it had worked, some
time ago.)
Probably some side-effect(s), but from what side?

Any help appreciated.

Thanks!
Frank Bruch

----------------------------------------------------------- 
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