Actually I don't think this problem is directly related to class hints. In a previous thread Armin mentioned to me that there was a but that will be fixed in the next released

previouse email from Armin:
> In the next version of OJB this will be fixed (or try the OJB_1_0_RELEASE branch from CVS) and
> CParty party = (CParty) getBroker().getObjectByIdentity(oid);
> will always return the correct object instance (CParty, CPartyGroup or Person) and you can directly cast to the real party type.

-chris worley


I am having a problem with class hints. They do not seem to work all the time with my configuration. If the PartyContactMech object is stored in the same instance of the server process that I retreive it in PartyContactMech.contactMech is populated with an instance of CPhoneNumber or CPostalAddress. If I try to reteive a records that were created in a previous instance of the process then PartyContactMech.contactMechs is populated with an instance of ContactMech.


Integer partyId = (Integer) getParameter("partyId");
Criteria crit = new Criteria();
crit.addEqualTo("partyId", partyId);
crit.addPathClass("contactMech", CPhoneNumber.class);
      Criteria critAddress = new Criteria();
critAddress.addEqualTo("partyId", partyId);
critAddress.addPathClass("contactMech", CPostalAddress.class);
      crit.addOrCriteria(critAddress);
      Query query = QueryFactory.newQuery(CPartyContactMech.class, crit);
Collection partyContactMechs = getBroker().getCollectionByQuery(query);
setParameter("partyContactMechs", partyContactMechs);


<class-descriptor
       class="net.enterprise.common.model.contact.CContactMech"
       table="contact_mech"
   >
<extent-class class-ref="net.enterprise.common.model.contact.CPhoneNumber"/> <extent-class class-ref="net.enterprise.common.model.contact.CPostalAddress"/>
     <field-descriptor
           name="contactMechId"
           column="contact_mech_id"
           jdbc-type="integer"
           primarykey="true"
           autoincrement="true"
       />
     <field-descriptor
           name="contactMechTypeId"
           column="contact_mech_type_id"
           jdbc-type="varchar"
       />
  </class-descriptor>


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



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

Reply via email to