db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: PersistentFields per class descriptors. was [RFC] Using java.lang.reflect.Proxy
Date Mon, 15 Mar 2004 10:27:03 GMT
Hi Leandro,

I agree that PersistentFieldClass configuration isn't flexible today 
(setting the standard class in OJB.properties may not fit all 
application ranges).

But I don't like setting PersistentFieldClass on class-descriptor level, 
because PersistentFieldClass is associated with field-descriptor/field 
attribute - it's a field-descriptor attribute.
E.g. if a user use java bean style setter/getter in all persistent 
capable classes and PersistentFieldIntrospectorImpl as standard 
PersistentFieldClass (set in OJB.properties). But for PK/FK fields he 
doesn't want to define setter/getter. Then it would be a useful 
improvement to allow setting of PersistentFieldClass on field-descriptor 
level (then user could specify PersistentFieldDirectAccessImpl for all 
PK/FK fields and standard PersistentFieldClass, in this example 
PersistentFieldIntrospectorImpl, for all other fields).

In future and if users request setting PersistentFieldClass on 
class-descriptor level, it could be a "convenience setting" if users 
don't want to define PersistentFieldClass on each field-descriptor.
But I don't recommend this, because it will make handling of metadata 
runtime changes more and more complex (e.g. user change 
PersistentFieldClass on class-descriptor at runtime).

-1, allow setting of PersistentFieldClass on class-descriptor level.
Or is this setting imperative to make something work?

regards,
Armin

Leandro Rodrigo Saad Cruz wrote:
> Sorry. It's working (see DescriptorRepository.discoverDescriptor(Class
> clazz) )
> 
> What do you thing about using PersistentFieldClass per class descriptors
> ? That would make the use (access to values) of Dynamic Proxies easier.
> 
> For class-descriptors that relate to Dynamic Proxies we could configure
> a different PersistentFieldClass, otherwise we could use the
> configuration on OJB.properties.
> 
> On Fri, 2004-03-12 at 18:10, Thomas Dudziak wrote:
> 
>>On Fri, 12 Mar 2004, Leandro Rodrigo Saad Cruz wrote:
>>
>>
>>>I'm trying to make java.lang.reflect.Proxy objects work with OJB, but I
>>>can't , since Proxy.getClass() returns "$Proxy" (and its final) and OJB
>>>makes heavy use of ref.getClass() or Class parameters. 
>>>
>>>I'd like to know what you think about a (huge) change on ojb codebase to
>>>handle cases like this. Most of the places that expect a Class ref would
>>>have to change that to String.
>>>
>>>Please, I'm trying to change ojb just to fit my needs. 
>>>If you don't think this is something that OJB should support please let
>>>me know. And I'll think about other solution.
>>
>>I recently changed proxy handling and class-descriptor handling to do
>>exactly that: all proxy-stuff within OJB specifically checks for OJB
>>proxies (via ProxyHelper: invocation handler is class IndirectionHandler),
>>and the method that determines a class descriptor for a given object not
>>only uses getClass but also getInterfaces (which is necessary for working
>>with proxies). Ad a side effect one can now also specify class descriptors
>>for interfaces (using factory-class/-method for creating actual
>>objects).
>>I also have one app using this feature, though not with 
>>collections/references.
>>
>>So, could you please specify what is not working ?
>>
>>Tom
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-dev-help@db.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message