Re: Opinion on using DO class as entity id!?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Jan 30 2003 - 17:38:14 EST


>
>> Is it possible for you to use java.lang.reflect.Proxy for this
>> purpose:
>>
>> http://java.sun.com/j2se/1.3/docs/api/java/lang/reflect/Proxy.html
>>
>> So far I couldn't find a single justified use of the Java Proxy
>> feature, but maybe this is just it? :-)
>>
>
> Nope, this wouldn't work because of the way JVM creates $Proxy classes.
> For all I know, you cannot control or vary their names for the same
> interface.

Haven't tried this, but probably you are right... Then Proxies are really
useless :-).

> I have found a solution though (only for the regression
> application - the general case remains unclear). I use Apache BCEL to
> generate empty classes with custom names extending CayenneDataObject at
> runtime and load them via a homemade ClassLoader bootstrapped to
> Configuration from a memory buffer.

Cool. Good to know that there is always a way around. As for the original
decision about typing entities by class, well...strong typing is always
less flexible than weak typing, for all its benefits. Nothing you can do
about it.

Andrus



This archive was generated by hypermail 2.0.0 : Thu Jan 30 2003 - 17:38:14 EST