I have two problems. the first is simple:
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
        org.apache.ojb.broker.accesslayer.CollectionProxy                   
                                                                            
                                                                            
                                                                            

does not appear in the API documentation at
http://db.apache.org/ojb/api/index.html, nor does anything else in
org.apache.ojb.broker.accesslayer.

The second  is probably my misunderstanding the documentation, or a gap in
the documentation. I am trying to use a dynamic proxy in a 1:1 relation. I
know that this has very little point, but at the moment I am just
experimenting.

If in the reference-descriptor I have auto-retrieve="true" proxy="false"
then all is well.
If I have auto-retrieve="true" proxy="true" then when I try to use the
referenced value I get an error about unmaterialised proxy, even when I try
to access the referenced object through a method which is in the public
interface.

Here is the xml
      <class-descriptor
            class="com.gsk.bet.EntityPreferedName"
            table="EntityPreferedName"
      >
            <field-descriptor
                  name="betid"
                  column="BETID"
                  jdbc-type="INTEGER"
                  primarykey="true"
                  autoincrement="false"
            />
[snip]
            <reference-descriptor
                  name="bet"
                  class-ref="com.gsk.bet.Entity"
                  proxy="true"
                  auto-retrieve="true"
            >
                  <foreignkey field-ref="betid"/>
            </reference-descriptor>
      </class-descriptor>

The Entity class has no foreign keys.

When I call EntityPreferedName.toString() I get
 Class class com.gsk.bet.EntityPreferedName betid:1 preferedNameid:1
entryDate:2003-03-06 person:Hugh
      unmaterialized proxy for com.gsk.bet.Entity{1}

The code looks like

public class EntityPreferedName {
      protected int betid;
[snip]
      protected EntityInterface bet;

public String toString()
{
      return "Class "+getClass()+
            " betid:" + String.valueOf(betid)+
      " preferedNameid:" + String.valueOf(preferedNameid)+
      " entryDate:" + entryDate +
      " person:" + person +
      "\n\t"+ getBet().toString();
}
      /**
       * @return
       */
      public int getBetid() {
            return betid;
      }


      /**
       * @return
       */
      public EntityInterface getBet() {
            return bet;
      }

      /**
       * @return
       */
      public EntityName getPreferedAbbreviationName() {
            return preferedAbbreviationName;
      }

[snip]

}



public interface EntityInterface {
      public String toString();

      public int getBetid() ;
      public String getDescriptor();
      public String getEntityType();
      public Date getEntryDate();
      public String getPerson();

      public void setBetid(int betid) ;
      public void setDescriptor(String string);
      public void setEntityType(String string) ;
      public void setEntryDate(Date date) ;
      public void setPerson(String string) ;
}




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

Reply via email to