db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: query for extents joining with null table
Date Tue, 08 Apr 2003 17:12:14 GMT
hi leandro,

the problem is the relationship referencing an abstract class. in the 
constructor of TableAlias an alias with NULL table is created.
i'm thinking of completely skipping this abstract alias, but  how ??

jakob


Jakob Braeuchi wrote:

> hi leandro,
>
> method createTableAlias checks abstract classes :
>
>    private TableAlias createTableAlias(ClassDescriptor cld, String path)
>    {
>        TableAlias alias;
>        boolean lookForExtents = false;
>
>        if (cld.isAbstract())
>        {
>            getLogger().warn("Creating TableAlias for abstract 
> ClassDescriptor: " + cld.getClassNameOfObject());
>        }
>           if (!cld.getExtentClasses().isEmpty() && path.length() > 0)
>        {
>            lookForExtents = true;
>        }
>
>        alias = new TableAlias(cld, "A" + m_pathToAlias.size(), 
> lookForExtents);
>        m_pathToAlias.put(path, alias);
>        return alias;
>
>
> jakob
>
> Leandro Rodrigo Saad Cruz wrote:
>
>> Hi Jacob !
>>
>> I'm upgrading from 0.9.8 to 1.0.rc2 an I got this problem :
>>
>> _________________       ________________
>> |                |     |                |
>> | AbstractClassA |1---*| AbstractClassB |
>> |________________|     |________________|
>>        ^                       ^
>>        |                       |
>>   -------------          ---------------     |           |          
>> |              |
>> ____         ____       ____          ____
>> |    |       |    |     |    |        |    |
>> | A1 |       | A2 |     | B1 |        | B2 |
>> |____|       |____|     |____|        |____|
>>
>>
>> When I use OJB like this :
>>
>> <java>
>> Criteria crit = new Criteria()
>> crit.addEqualTo("allBs.name",someName)
>> QueryByCriteria query = new QueryByCriteria(AbstractClassA.class,crit);
>> Collection result = broker.gteCollectionByQuery(query)
>> <java>
>>
>> I get an error because ojb is joinning with three tables
>> AbstractClassB - NO TABLE
>> B1             - TABLE_B_1
>> B2             - TABLE_B_2
>>
>> <sql>
>> SELECT * FROM TABLE_A_1 A0 INNER JOIN ((((((TABLE_A_VERSUS_B A1 INNER 
>> JOIN null
>> A2 ON A1.AID_ID=A2.AID) LEFT OUTER JOIN TABLE_B_1 A2E1 ON
>> A1.AID=A2E1.ID) LEFT OUTER JOIN TABLE_B_2 A2E2 ON ...
>> </sql>
>>
>> We are trying to join with the table that AbstractClassB should have,
>> but it doesn't ! I looked at SqlQueryStatement.java and I'm not sure
>> where I have to make modifications for this to work.
>>
>> When I first implemented extent aware path expressions I put a log
>> warning (see createTableAlias(ClassDescriptor cld, String path)) about
>> abstract classes, but I think there is not place anymore where we check
>> for this !
>>
>> Can you help me solve this problem !
>>
>>
>>  
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>


Mime
View raw message