After doing some testing. I am finding that sometimes I get the
exception, sometimes it works and sometimes the contactMech is populated
with an instance of CPhoneNumber (which is what i want) and sometimes it
just populates with CContactMech. CPhoneNumber extends CContactMech.
I have modified the code on the server to use class hints.
The only pattern I am finding is that I can retreive the
PartyContactMech without an exception if the obejct was created during
the life of the server process. If i start the server and retreive one
that was not created during the life of the process then I get the
exception. Sounds like it works fine when the objects are cached, but
thats just an assumption.
I also stopped using a the dynamic proxy for PartyContactMech.
-chris worley
I have a similar error when using. I am able to set fields with other
objects when retreiving them from the db. This particular class is
giving me some problems.
PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImplNew
org.apache.ojb.broker.PersistenceBrokerException: Error invoking
method afterLookup
at
org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.invoke(Unknown
Source)
at $Proxy0.afterLookup(Unknown Source)
at
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.performCallBack(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerAbstractImpl.fireBrokerEvent(Unknown
Source)
at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
at
net.enterprise.server.service.contact.CFindPartyContactMechByPartyIdService.doExecute(CFindPartyContactMechByPartyIdService.java:31)
at net.enterprise.common.service.CService.execute(CService.java:45)
at
net.enterprise.common.service.CServiceExecutor.execute(CServiceExecutor.java:66)
at
net.enterprise.common.service.CLocalDispatcher.execute(CLocalDispatcher.java:41)
at
net.enterprise.server.service.contact.CFindContactService.doExecute(CFindContactService.java:48)
at net.enterprise.common.service.CService.execute(CService.java:45)
at
net.enterprise.common.service.CServiceExecutor.execute(CServiceExecutor.java:66)
at
net.enterprise.server.service.CServiceProcess.run(CServiceProcess.java:53)
Caused by: org.apache.ojb.broker.PersistenceBrokerException:
org.apache.ojb.broker.metadata.MetadataException: Error invoking
method:setContactMech in
object:net.enterprise.common.model.party.CPartyContactMech
at
org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.materializeSubject(Unknown
Source)
at
org.apache.ojb.broker.core.proxy.IndirectionHandlerDefaultImpl.getRealSubject(Unknown
Source)
... 19 more
Caused by: org.apache.ojb.broker.metadata.MetadataException: Error
invoking method:setContactMech in
object:net.enterprise.common.model.party.CPartyContactMech
at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImplNew.setValueFor(Unknown
Source)
at
org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImplNew.set(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReference(Unknown
Source)
at
org.apache.ojb.broker.core.QueryReferenceBroker.retrieveReferences(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(Unknown
Source)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
Source)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
Source)
... 21 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
... 30 more
I get and IllegalAccess exception when ojb tries to populate a
reference to another object. I have no problems storing the object.
The exception is attached and below is my code and mapping.
----- Code --------
Integer partyId = (Integer) getParameter("partyId");
Criteria crit = new Criteria();
crit.addEqualTo("partyId", partyId);
Query query = QueryFactory.newQuery(CPartyContactMech.class, crit);
setParameter("partyContactMechs",
getBroker().getCollectionByQuery(query));
---- Exception ---------
Caused by: org.apache.ojb.broker.PersistenceBrokerException:
org.apache.ojb.broker.metadata.MetadataException: IllegalAccess error
setting field:contactMech in
object:net.enterprise.common.model.party.CPartyContactMech
---- Mapping ------
<!-- Contact Mech -->
<class-descriptor
class="net.enterprise.common.model.contact.CContactMech"
proxy="dynamic"
table="contact_mech"
>
<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>
<!-- Party Contact Mech -->
<class-descriptor
class="net.enterprise.common.model.party.CPartyContactMech"
proxy="dynamic"
table="party_contact_mech"
>
<field-descriptor
name="partyContactMechId"
column="party_contact_mech_id"
jdbc-type="integer"
primarykey="true"
autoincrement="true"
/>
<field-descriptor
name="partyId"
column="party_id"
jdbc-type="integer"
/>
<field-descriptor
name="contactMechId"
column="contact_mech_id"
jdbc-type="integer"
/>
<field-descriptor
name="fromDate"
column="from_date"
jdbc-type="timestamp"
/>
<field-descriptor
name="thruDate"
column="thru_date"
jdbc-type="timestamp"
/>
<field-descriptor
name="contactMechPurposeId"
column="contact_mech_purpose_id"
jdbc-type="integer"
/>
<reference-descriptor
name="contactMech"
class-ref="net.enterprise.common.model.contact.CContactMech"
auto-retreive="true"
auto-update="true"
>
<foreignkey field-ref="contactMechId"/>
</reference-descriptor>
<reference-descriptor
name="party"
class-ref="net.enterprise.common.model.party.CParty"
auto-retreive="true"
auto-update="true"
>
<foreignkey field-ref="partyId"/>
</reference-descriptor>
</class-descriptor>
thanks
-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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]