hi dogie,
i can't see the difference between the two mappings except the sequence of the
definition of the IA-classes :(
do you have an sql trace to show the different behaviour ?
jakob
蔡博至 wrote:
> Hi! Armin
> I found if a class implement 2 interface, another class referance a
> interface of both. OJB can not prefetch the referance object successfully.
> Example:
> public class A implement IA1,IA2{
> private String OID;
> public String getOID(){
> return OID;
> }
> public void setOID(String pNewValue){
> OID = pNewValue;
> }
> :
> :
> }
> public interface IA1{
> }
> public interface IA2{
> }
>
> public class B{
> private String AOID;
> public String getAOID(){
> return AOID;
> }
> public void setAOID(String pNewValue){
> AOID= pNewValue;
> }
> private A referanceA;
> public A getReferanceA(){
> return referanceA;
> }
> public void setReferanceA(A pNewValue){
> referanceA= pNewValue;
> }
> }
>
> if i declare repository_user:
>
> <class-descriptor class="IA1">
> <extent-class class-ref="A"/>
> </class-descriptor>
> <class-descriptor class="IA2">
> <extent-class class-ref="A"/>
> </class-descriptor>
> <class-descriptor isolation-level="optimistic" class="A" table="A">
> <field-descriptor name="OID" column="OID" jdbc-type="CHAR" primarykey="true"
> autoincrement="true" nullable="false"/>
>
> :
>
> :
> </class-descriptor>
>
> <class-descriptor isolation-level="optimistic" class="B" table="B">
> <field-descriptor name="OID" column="OID" jdbc-type="CHAR" primarykey="true"
> autoincrement="true" nullable="false"/>
> <field-descriptor name="AOID" column="AOID" jdbc-type="CHAR" nullable="false"/>
> <reference-descriptor name="referanceA" class-ref="IA1">
> <foreignkey field-ref="AOID"/>
> </reference-descriptor>
> </class-descriptor>
>
> I query a B class, but when I call getReferanceA method , it return null.
> I found something wrong in associateBatched method of
> org.apache.ojb.broker.accesslayer.ReferencePrefetcher.
> In line 115 of org.apache.ojb.broker.accesslayer.ReferencePrefetcher, the id is
> IA1(OID),but in line 119 the id2 is IA2(OID).
> So in line 120 ,the two parameters is not qeual, and don't excute set.
>
>
> But if I repository_user:
>
> <class-descriptor class="IA2">
> <extent-class class-ref="A"/>
> </class-descriptor>
>
> <class-descriptor class="IA1">
> <extent-class class-ref="A"/>
> </class-descriptor>
>
> <class-descriptor isolation-level="optimistic" class="A" table="A">
> <field-descriptor name="OID" column="OID" jdbc-type="CHAR" primarykey="true"
> autoincrement="true" nullable="false"/>
>
> :
>
> :
> </class-descriptor>
>
> <class-descriptor isolation-level="optimistic" class="B" table="B">
> <field-descriptor name="OID" column="OID" jdbc-type="CHAR" primarykey="true"
> autoincrement="true" nullable="false"/>
> <field-descriptor name="AOID" column="AOID" jdbc-type="CHAR" nullable="false"/>
> <reference-descriptor name="referanceA" class-ref="IA1">
> <foreignkey field-ref="AOID"/>
> </reference-descriptor>
> </class-descriptor>
>
> I can query B and get A by calling getReferanceA method. Because the id and id2 both
> are IA1(OID).
> Dose anyone have the same problem?
>
> regards,
> Dogie
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]