Re: Class Hints

2005-12-07 Thread Chris Worley



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-ref="net.enterprise.common.model.contact.CPhoneNumber"/>
   class-ref="net.enterprise.common.model.contact.CPostalAddress"/>

 
 
  


-
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]



Class Hints

2005-12-07 Thread 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-ref="net.enterprise.common.model.contact.CPhoneNumber"/>
   class-ref="net.enterprise.common.model.contact.CPostalAddress"/>
  
   
   name="contactMechId"
   column="contact_mech_id"
   jdbc-type="integer"
   primarykey="true"
   autoincrement="true"
   />
  
   
   name="contactMechTypeId"
   column="contact_mech_type_id"
   jdbc-type="varchar"
   />
  




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



Re: IllegalAccess When Setting Field

2005-12-07 Thread Armin Waibel

Chris Worley wrote:

Armin,

I removed the dynamic proxy from the class descriptors and every thing 
works fine.  I have not studied them enough to undertand how to handle 
them.




In the upcoming 1.0.4 release it will be possible to use proxy handler 
classes based on cglib(enabled via OJB.properties file), these 
implementation classes allow the generation of dynamic proxies that do 
not require the persistent class to implement an interface.


regards,
Armin



-chris worley


Hi,

ok, now we have a more detailed error message:

[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: net.enterprise.common.model.party.CPartyContactMech
target field name: contactMech
target field type: class net.enterprise.common.model.contact.CContactMech
target field declared in: 
net.enterprise.common.model.party.CPartyContactMech

object value class: $Proxy0
object value: [EMAIL PROTECTED]
]

Seems that OJB try to set the field in a correct way. You declare 
CContactMech as dynamic proxy and OJB try to set such an instance in 
CPartyContactMech.
Think the field you declare in CPartyContactMech have to be an 
Interface if you want to use a normal dynamic proxy in this case



   


Why did you declare CContactMech class objects as proxy? Wouldn't it 
be better to use a proxy-reference for the 1:1 relation between 
CPartyContactMech and CContactMech?



   


regards,
Armin

Chris Worley wrote:


Armin,

Here is the complete output at the time the service is invoked.  For 
this I have set all proxies back to dynamic in the class 
descriptors.  If I comment out the reference to the contactMech the 
party reference gets populated just fine.  I am not sure what the 
deail is with the ContactMech.


[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] 
DEBUG: createPool was called
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] 
DEBUG: makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyRole, QueryByCriteria from 
class net.enterprise.common.model.party.CPartyRole  where [partyId = 
181])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to 
cache: net.enterprise.common.model.party.CParty{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to 
cache: net.enterprise.common.model.party.CPartyGroup{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyContactMech, QueryByCriteria 
from class net.enterprise.common.model.party.CPartyContactMech  where 
[partyId = 181, [partyId = 181]])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl] INFO: 
Create new PB instance for PBKey org.apache.ojb.broker.PBKey: 
jcdAlias=enterprise, user=enterprise, password=*, already created 
persistence broker instances: 1
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Start creating 
new ObjectCache instance
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Instantiate 
new org.apache.ojb.broker.cache.CacheDistributor for PB instance 
[EMAIL PROTECTED]
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: New 
ObjectCache instance was created
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
create new sequence manager for broker 
[EMAIL PROTECTED]
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
Jdbc-Connection-Descriptor 'enterprise' use sequence manager: class 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] 
DEBUG: makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called

[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: net.enterprise.common.model.party.CPartyContactMech
target field name: contactMech
tar

Re: IllegalAccess When Setting Field

2005-12-07 Thread Chris Worley

Armin,

I removed the dynamic proxy from the class descriptors and every thing 
works fine.  I have not studied them enough to undertand how to handle them.


-chris worley


Hi,

ok, now we have a more detailed error message:

[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: net.enterprise.common.model.party.CPartyContactMech
target field name: contactMech
target field type: class net.enterprise.common.model.contact.CContactMech
target field declared in: 
net.enterprise.common.model.party.CPartyContactMech

object value class: $Proxy0
object value: [EMAIL PROTECTED]
]

Seems that OJB try to set the field in a correct way. You declare 
CContactMech as dynamic proxy and OJB try to set such an instance in 
CPartyContactMech.
Think the field you declare in CPartyContactMech have to be an 
Interface if you want to use a normal dynamic proxy in this case



   


Why did you declare CContactMech class objects as proxy? Wouldn't it 
be better to use a proxy-reference for the 1:1 relation between 
CPartyContactMech and CContactMech?



   


regards,
Armin

Chris Worley wrote:


Armin,

Here is the complete output at the time the service is invoked.  For 
this I have set all proxies back to dynamic in the class 
descriptors.  If I comment out the reference to the contactMech the 
party reference gets populated just fine.  I am not sure what the 
deail is with the ContactMech.


[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] 
DEBUG: createPool was called
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] 
DEBUG: makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyRole, QueryByCriteria from 
class net.enterprise.common.model.party.CPartyRole  where [partyId = 
181])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to 
cache: net.enterprise.common.model.party.CParty{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to 
cache: net.enterprise.common.model.party.CPartyGroup{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyContactMech, QueryByCriteria 
from class net.enterprise.common.model.party.CPartyContactMech  where 
[partyId = 181, [partyId = 181]])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl] INFO: 
Create new PB instance for PBKey org.apache.ojb.broker.PBKey: 
jcdAlias=enterprise, user=enterprise, password=*, already created 
persistence broker instances: 1
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Start creating 
new ObjectCache instance
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Instantiate 
new org.apache.ojb.broker.cache.CacheDistributor for PB instance 
[EMAIL PROTECTED]
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: New 
ObjectCache instance was created
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
create new sequence manager for broker 
[EMAIL PROTECTED]
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
Jdbc-Connection-Descriptor 'enterprise' use sequence manager: class 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] 
DEBUG: makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called

[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: net.enterprise.common.model.party.CPartyContactMech
target field name: contactMech
target field type: class 
net.enterprise.common.model.contact.CContactMech
target field declared in: 
net.enterprise.common.model.party.CPartyContactMech

object value class: $Proxy0
object value: [EMAIL PROTECTED]
]
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache

Re: IllegalAccess When Setting Field

2005-12-07 Thread Armin Waibel

Hi,

ok, now we have a more detailed error message:

[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: net.enterprise.common.model.party.CPartyContactMech
target field name: contactMech
target field type: class net.enterprise.common.model.contact.CContactMech
target field declared in: 
net.enterprise.common.model.party.CPartyContactMech

object value class: $Proxy0
object value: [EMAIL PROTECTED]
]

Seems that OJB try to set the field in a correct way. You declare 
CContactMech as dynamic proxy and OJB try to set such an instance in 
CPartyContactMech.
Think the field you declare in CPartyContactMech have to be an Interface 
if you want to use a normal dynamic proxy in this case



   


Why did you declare CContactMech class objects as proxy? Wouldn't it be 
better to use a proxy-reference for the 1:1 relation between 
CPartyContactMech and CContactMech?



   


regards,
Armin

Chris Worley wrote:

Armin,

Here is the complete output at the time the service is invoked.  For 
this I have set all proxies back to dynamic in the class descriptors.  
If I comment out the reference to the contactMech the party reference 
gets populated just fine.  I am not sure what the deail is with the 
ContactMech.


[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
createPool was called
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyRole, QueryByCriteria from class 
net.enterprise.common.model.party.CPartyRole  where [partyId = 181])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to cache: 
net.enterprise.common.model.party.CParty{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to cache: 
net.enterprise.common.model.party.CPartyGroup{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyContactMech, QueryByCriteria 
from class net.enterprise.common.model.party.CPartyContactMech  where 
[partyId = 181, [partyId = 181]])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl] INFO: 
Create new PB instance for PBKey org.apache.ojb.broker.PBKey: 
jcdAlias=enterprise, user=enterprise, password=*, already created 
persistence broker instances: 1
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Start creating 
new ObjectCache instance
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Instantiate new 
org.apache.ojb.broker.cache.CacheDistributor for PB instance 
[EMAIL PROTECTED]
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: New ObjectCache 
instance was created
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
create new sequence manager for broker 
[EMAIL PROTECTED]
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
Jdbc-Connection-Descriptor 'enterprise' use sequence manager: class 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called

[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: net.enterprise.common.model.party.CPartyContactMech
target field name: contactMech
target field type: class net.enterprise.common.model.contact.CContactMech
target field declared in: 
net.enterprise.common.model.party.CPartyContactMech

object value class: $Proxy0
object value: [EMAIL PROTECTED]
]
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb

Re: IllegalAccess When Setting Field

2005-12-07 Thread Chris Worley

Armin,

My ojb version is 1.0.3.

-chris worley


Armin,

Here is the complete output at the time the service is invoked.  For 
this I have set all proxies back to dynamic in the class descriptors.  
If I comment out the reference to the contactMech the party reference 
gets populated just fine.  I am not sure what the deail is with the 
ContactMech.


[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
createPool was called
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyRole, QueryByCriteria from 
class net.enterprise.common.model.party.CPartyRole  where [partyId = 
181])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to 
cache: net.enterprise.common.model.party.CParty{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to 
cache: net.enterprise.common.model.party.CPartyGroup{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyContactMech, QueryByCriteria 
from class net.enterprise.common.model.party.CPartyContactMech  where 
[partyId = 181, [partyId = 181]])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl] INFO: 
Create new PB instance for PBKey org.apache.ojb.broker.PBKey: 
jcdAlias=enterprise, user=enterprise, password=*, already created 
persistence broker instances: 1
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Start creating 
new ObjectCache instance
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Instantiate new 
org.apache.ojb.broker.cache.CacheDistributor for PB instance 
[EMAIL PROTECTED]
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: New ObjectCache 
instance was created
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
create new sequence manager for broker 
[EMAIL PROTECTED]
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
Jdbc-Connection-Descriptor 'enterprise' use sequence manager: class 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called

[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: net.enterprise.common.model.party.CPartyContactMech
target field name: contactMech
target field type: class net.enterprise.common.model.contact.CContactMech
target field declared in: 
net.enterprise.common.model.party.CPartyContactMech

object value class: $Proxy0
object value: [EMAIL PROTECTED]
]
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
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

Re: IllegalAccess When Setting Field

2005-12-07 Thread Chris Worley

Armin,

Here is the complete output at the time the service is invoked.  For 
this I have set all proxies back to dynamic in the class descriptors.  
If I comment out the reference to the contactMech the party reference 
gets populated just fine.  I am not sure what the deail is with the 
ContactMech.


[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
createPool was called
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyRole, QueryByCriteria from class 
net.enterprise.common.model.party.CPartyRole  where [partyId = 181])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to cache: 
net.enterprise.common.model.party.CParty{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: 
Materialisation of object is finished, push 1objects to cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Push to cache: 
net.enterprise.common.model.party.CPartyGroup{181}
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.core.QueryReferenceBroker] DEBUG: 
getCollectionByQuery (class 
org.apache.ojb.broker.util.collections.RemovalAwareCollection, class 
net.enterprise.common.model.party.CPartyContactMech, QueryByCriteria 
from class net.enterprise.common.model.party.CPartyContactMech  where 
[partyId = 181, [partyId = 181]])
[org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$TableAlias] 
DEBUG: TableAlias(): using hints ? false
[org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl] INFO: 
Create new PB instance for PBKey org.apache.ojb.broker.PBKey: 
jcdAlias=enterprise, user=enterprise, password=*, already created 
persistence broker instances: 1
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Start creating 
new ObjectCache instance
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: Instantiate new 
org.apache.ojb.broker.cache.CacheDistributor for PB instance 
[EMAIL PROTECTED]
[org.apache.ojb.broker.cache.ObjectCacheFactory] INFO: New ObjectCache 
instance was created
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
create new sequence manager for broker 
[EMAIL PROTECTED]
[org.apache.ojb.broker.util.sequence.SequenceManagerFactory] DEBUG: 
Jdbc-Connection-Descriptor 'enterprise' use sequence manager: class 
org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl
[org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] DEBUG: 
makeObject called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called
[org.apache.ojb.broker.accesslayer.StatementManager] DEBUG: 
closeResources was called

[PersistentField] ERROR: while set field:
[try to set 'object value' in 'target object'
target obj class: net.enterprise.common.model.party.CPartyContactMech
target field name: contactMech
target field type: class net.enterprise.common.model.contact.CContactMech
target field declared in: 
net.enterprise.common.model.party.CPartyContactMech

object value class: $Proxy0
object value: [EMAIL PROTECTED]
]
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
[org.apache.ojb.broker.cache.MaterializationCache] DEBUG: Clear 
materialization cache
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.QueryReferenceB

Re: IllegalAccess When Setting Field

2005-12-07 Thread Armin Waibel

Hi Chris,

which version of OJB do you use? Normally OJB will generate a more 
detailed error log when field setting fails.


Caused by: org.apache.ojb.broker.metadata.MetadataException: 
IllegalAccess error setting field:contactMech in 
object:net.enterprise.common.model.party.CPartyContactMech


Did you post the whole stack trace with complete error log?

regards,
Armin

Chris Worley wrote:


I have now removed proxy="dynamic" from all my class descriptors and I 
no longer get the exception.






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

Re: IllegalAccess When Setting Field

2005-12-07 Thread Chris Worley


I have now removed proxy="dynamic" from all my class descriptors and I 
no longer get the exception.






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

Re: IllegalAccess When Setting Field

2005-12-07 Thread Chris Worley



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 = (In