You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Rémi Bars <rb...@softeam.fr> on 2003/10/30 15:34:19 UTC

PersistentFieldIntrospectorImpl

Hi all,

i don't understand the use of the PersistentFieldIntrospectorImpl class.

in the OJB.properties i read:

# - PersistentFieldIntrospectorImpl
#   uses JavaBeans compliant calls only to access persistent attributes.
#   No Reflection is needed. But for each attribute xxx there must be
#   public getXxx() and setXxx() methods.

and in the code i read

org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl

 protected PropertyDescriptor findPropertyDescriptor(Class aClass, String
aPropertyName) {
...
 pd = info.getPropertyDescriptors();
...
}

when my class extends another class, the introspector don't find the field
from the parent,

-> why don't u use the info.getMethodDescriptors() as mentionned in the
properties file?

how do u do that?

thank for ur help

Remi


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


Re: PersistentFieldIntrospectorImpl

Posted by Armin Waibel <ar...@code-au-lait.de>.
Sorry, get your last post too late ;-)

Armin

Armin Waibel wrote:

> Hi,
> 
> Rémi Bars wrote:
> 
>> Hi all,
>>
>> i don't understand the use of the PersistentFieldIntrospectorImpl class.
>>
>> in the OJB.properties i read:
>>
>> # - PersistentFieldIntrospectorImpl
>> #   uses JavaBeans compliant calls only to access persistent attributes.
>> #   No Reflection is needed. But for each attribute xxx there must be
>> #   public getXxx() and setXxx() methods.
>>
>> and in the code i read
>>
>> org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl 
>>
>>
>>  protected PropertyDescriptor findPropertyDescriptor(Class aClass, String
>> aPropertyName) {
>> ...
>>  pd = info.getPropertyDescriptors();
>> ...
>> }
>>
>> when my class extends another class, the introspector don't find the 
>> field
>> from the parent,
>>
>> -> why don't u use the info.getMethodDescriptors() as mentionned in the
>> properties file?
>>
> I'm not familiar with java.beans package.
> So what's wrong invoking
> "Method m = getPropertyDescriptor().getWriteMethod();"
> write method for the property to set the value?
> 
> and
> "Method m = getPropertyDescriptor().getReadMethod();"
> invoke read method to get the value?
> 
> regards,
> Armin
> 
>> how do u do that?
>>
>> thank for ur help
>>
>> Remi
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 



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


store object[]

Posted by Rémi Bars <rb...@softeam.fr>.
How do u store a m:n relation which looks like an array?

when i try to do that i get the following error

java.lang.ClassCastException

 at
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Persistenc
eBrokerImpl.java:785)

 at
org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBroker
Impl.java:2007)

(normal in the code we try to cast the array as a collection :
deleteMtoNImplementor(cds, obj, (Collection)col, currentMtoNKeys);

)

remi


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


Re: PersistentFieldIntrospectorImpl

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi again,

Rémi Bars wrote:

>>I'm not familiar with java.beans package.
>>So what's wrong invoking
>>"Method m = getPropertyDescriptor().getWriteMethod();"
>>write method for the property to set the value?
> 
> 
> this method (getPropertyDescriptor().) don't see the parent's field.....
> 
hmm, I don't understand "parent's field", do you mean fields
of super classes? If yes, these fields will be included.

Armin

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



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


Re: PersistentFieldIntrospectorImpl

Posted by Rémi Bars <rb...@softeam.fr>.
> I'm not familiar with java.beans package.
> So what's wrong invoking
> "Method m = getPropertyDescriptor().getWriteMethod();"
> write method for the property to set the value?

this method (getPropertyDescriptor().) don't see the parent's field.....

remi

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


Re: PersistentFieldIntrospectorImpl

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi,

Rémi Bars wrote:

> Hi all,
> 
> i don't understand the use of the PersistentFieldIntrospectorImpl class.
> 
> in the OJB.properties i read:
> 
> # - PersistentFieldIntrospectorImpl
> #   uses JavaBeans compliant calls only to access persistent attributes.
> #   No Reflection is needed. But for each attribute xxx there must be
> #   public getXxx() and setXxx() methods.
> 
> and in the code i read
> 
> org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl
> 
>  protected PropertyDescriptor findPropertyDescriptor(Class aClass, String
> aPropertyName) {
> ...
>  pd = info.getPropertyDescriptors();
> ...
> }
> 
> when my class extends another class, the introspector don't find the field
> from the parent,
> 
> -> why don't u use the info.getMethodDescriptors() as mentionned in the
> properties file?
> 
I'm not familiar with java.beans package.
So what's wrong invoking
"Method m = getPropertyDescriptor().getWriteMethod();"
write method for the property to set the value?

and
"Method m = getPropertyDescriptor().getReadMethod();"
invoke read method to get the value?

regards,
Armin

> how do u do that?
> 
> thank for ur help
> 
> Remi
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 



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


Re: PersistentFieldIntrospectorImpl

Posted by Rémi Bars <rb...@softeam.fr>.
ok it is in the doc tutorial3.htm....

sorry :)

remi

----- Original Message ----- 
From: "Rémi Bars" <rb...@softeam.fr>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Thursday, October 30, 2003 3:34 PM
Subject: PersistentFieldIntrospectorImpl


> Hi all,
>
> i don't understand the use of the PersistentFieldIntrospectorImpl class.
>
> in the OJB.properties i read:
>
> # - PersistentFieldIntrospectorImpl
> #   uses JavaBeans compliant calls only to access persistent attributes.
> #   No Reflection is needed. But for each attribute xxx there must be
> #   public getXxx() and setXxx() methods.
>
> and in the code i read
>
> org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldIntrospectorImpl
>
>  protected PropertyDescriptor findPropertyDescriptor(Class aClass, String
> aPropertyName) {
> ...
>  pd = info.getPropertyDescriptors();
> ...
> }
>
> when my class extends another class, the introspector don't find the field
> from the parent,
>
> -> why don't u use the info.getMethodDescriptors() as mentionned in the
> properties file?
>
> how do u do that?
>
> thank for ur help
>
> Remi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


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