[OJB-developers] extent problem,proxies
Brought to you by:
thma
From: Georg S. <ge...@me...> - 2002-03-12 13:13:47
|
Hi, I ran into an interesting problem. It goes like this: I have a class A which implements an interface IA. repository.xml therefore has an extent section. A is loaded with a dynamic proxy. I can now do OQL queries like the following without a problem: select anyIA from IA where ..... The problem starts when I say: select anyA from A where .... I don't get any results back due to the following: In RsIterator, getIdentityFromResultSet() the following happens, return new Identity(getExtentClass(),pkValues); getExtentClass() in the end calls the DescriptorRepository getExtentClass() method and assigns the first available baseclass or interface(another problem I'll come to in a minute) in our case this is IA in PersistenceBrokerImpl , public ManageableCollection getCollectionByQuery(Class collectionClass, Query query, boolean lazy) the following lines are reached if (itemClass.isAssignableFrom(candidateClass)) { tmpMap.add(candidate); } itemClass would be A in our case and candidateClass is IA and since it is obviously not possible to cast IA onto A, the object is not added to the result. Another possible problem in this respect could be the fact mentioned earlier that the method getExtentClass(Class clazz) in DescriptorRepository just returns the first baseclass or interface it encounters, so if a class is a member of various extents a random baseclass or interface will be returned as first one in each run of a program due to the fact that Iterator iter = m_DescriptorTable.values().iterator(); ist called and since m_DescriptorTable is a Hashtable it doesn't guarantee any special order of values returned. Regards Georg |