db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian McCallister <mccallis...@forthillcompany.com>
Subject Re: PersistentFields per class descriptors. was [RFC] Using java.lang.reflect.Proxy
Date Mon, 15 Mar 2004 14:13:56 GMT
I completely agree that something along these lines should be done (not  
the least of which because it will let us expunge the first, and  
ugliest, code I contributed to OJB ;-).

I agree with Armin that it is a field-descriptor level setting. The  
class descriptor could be a (major convenience) but I would lean  
towards implementing it as syntactic sugar in the configuration parser  
rather than making that available in the runtime metadata (and  
requiring cascaded searches for how to access the field).

Presuming this is for 1.0.1 and/or 1.1...

+1 on field
+0 on class

-1 for introducing it in 1.0

-Brian

On Mar 15, 2004, at 8:57 AM, Leandro Rodrigo Saad Cruz wrote:

> I agree with Thomas.
> Setting the PersistentFieldClass is desirable on both levels, class and
> field descriptors. I can add this feature : if there is a
> persistent-field-class attribute present on a field-descriptor element,
> it overrides the class-descriptor settings. Is that ok ?
>
> I really think this is a desirable feature. I'm trying to use
> DynamicProxy objects work with obj and the PersistentFieldClass must
> call its getters and setters, but this is not true for other objects
> where calling getters/setters is not an option. So, obj should provide
> different PersistentFieldClass at the class/field level.
>
> On Mon, 2004-03-15 at 07:27, Armin Waibel wrote:
>> 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
> -- 
> Leandro Rodrigo Saad Cruz
> InterBusiness Tecnologia e Servi├žos
> IB    - www.ibnetwork.com.br
> DB    - www.digitalbrand.com.br
> OJB   - db.apache.org/ojb
> XINGU - xingu.sf.net
>
>
> ---------------------------------------------------------------------
> 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