Re: How to check for null values when using proxies?

Armin Waibel <[email protected]> Wed, 20 Feb 2008 00:58:50 +0100
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>

Armin Waibel wrote:
> 
>> In the 1:n associations I set auto-retrieve="false"
>> and proxy="dynamic". As my classes do not implement interfaces, I'm using
>> CGLib as ProxyFactoryClass.
> 

Now I get your point. You are using dynamic proxies for the referenced 
objects (and maybe a proxy reference for the 1:n relation too) and OJB 
return the wrong instance for all subclasses.


>> Another problem that came up after I started using proxies is in the
>> hierarchy mapping. I'm using just one table to map my class hierarchy. 
>> So,
>> this table has a CLASSNAME field to identify which class to load. In the
>> constructor of my base class I have a
>> setOjbConcreteClass(this.getClass().getName()) call. Before using 
>> proxies,
>> the class name was configured correctly. But after, instead of having the
>> real object class name, the application configures the classname field 
>> using
>> the proxy class name.
>>
>> I assume there should be something wrong with my mapping files or some 
>> other
>> point in my application. As said earlier, I believe proxies should be
>> transparent. Did someone here experience the same problems?
> 
> Hm, I will have a look at this tomorrow (will try to reproduce your issue).

I can reproduce the issue and create a bug report:
http://issues.apache.org/jira/browse/OJB-138

Setup some new tests and it seems that I can fix it soon.


regards,
Armin