Hi All!
The problem is  in incorrect building of sql statement for quering
objects by criteria, where proxy is used.

I use OJB 0.9.5
I have object types PlanImpl, Subscription.
Subscription contains a plan ,  1:1 mapping.
    <reference-descriptor name="plan" proxy="true" refresh="true" class-ref="Plan">
      <foreignkey field-id-ref="12"/>
    </reference-descriptor>

plan reference is proxy, so there is mapping for interface Plan.
<class-descriptor class="Plan">
      <extent-class class-ref="PlanImpl" />
</class-descriptor>
    

I want to load objects using criteria.

    Criteria criteria = new Criteria();

    criteria.addEqualTo( "plan.name", "aaaa" );
  
    Query query = new QueryByCriteria( Subscription.class, criteria );

    Collection queryResult = db.getByQuery( query );
  
Result sql is:
 SELECT A0.state,A0.id,A0.end_date,A0.begin_date,A0.plan_id, A0.owner_id
 FROM
 subscription A0
 INNER JOIN
>>>  null  <<<  A1 ON A0.plan_id=A1.id WHERE plan.name =  'aaaa'

Joined table name is null.
I debugged that operation ( SqlStatement.getTableAlias() ) and found, that when OJB
is looking for  table name for join, it found , that Subscription.plan
member was described as of _Plan_ type, so it gets table name from its
class descriptor, but table name should be taken from _PlanImpl_ class
descriptor!!! Plan's descriptor , of course, does not have table name
defined.(null)
Defining that field as of type PlanImpl helps, but it does not satisfy me,
I need proxy for that field.

What can you say about it?
Is there some way to fix it quickly?
In cvs it seems that accesslayer is under global reconstruction.

Thank you!
 
Best regards,
Andrey Chernyh<[EMAIL PROTECTED]>
Plesk Inc.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to