I have found my problem. I was using the <extent> tag for in the
descriptor for party referencing PartyGroup and Person. After removing
the extent the correct instance is returned.
-chris worley
In the following code I get a ClassCastException when querying for the
PartyGroup or Person. PartyGroup and Person both extend Party.
Party.partyTypeId will determine if the party is a person or party
group. If the party is one of the two then I want to get the party
group or person object and return it. However, when the code queries
a second time for the person or party group a ClassCastException
occurs. getObjectByIdeneity(...) is retruning an instance of CParty,
even though when the Identity was build I passed CPartyGroup.class as
the param no CParty.class.
If I modify the code not to query for CParty first and just query for
CPartyGroup I will get an instance of CPartyGroup. But, for some
reason by building the CParty identity first the second attempt for
CPartyGroup still returns an instance of CParty. ....and I have no
idea why.
Can anyone shed some light on what is going on and why I continue to
get an instance of CParty and not CPartyGroup or CPerson.
// Find the party
Identity oid =
getBroker().serviceIdentity().buildIdentity(CParty.class, partyId);
CParty party = (CParty) getBroker().getObjectByIdentity(oid);
if (CParty.TYPE_PARTY_GROUP.equals(party.getPartyTypeId()))
{
// Get the Party Group
Identity partyGroupId =
getBroker().serviceIdentity().buildIdentity(CPartyGroup.class, partyId);
// ClastCastException here
CPartyGroup partyGroup = (CPartyGroup)
getBroker().getObjectByIdentity(partyGroupId);
setParameter("party", partyGroup);
}
else if (CParty.TYPE_PERSON.equals(party.getPartyTypeId()))
{
// Get the person
Identity personId =
getBroker().serviceIdentity().buildIdentity(CPerson.class, partyId);
// ClastCastException here
CPerson person = (CPerson) getBroker().getObjectByIdentity(personId);
setParameter("party", person);
}
else
{
setParameter("party", party);
}
-chris worley
---------------------------------------------------------------------
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]