The problem is the object model cannot be modified.

-----Message d'origine-----
De : Thomas Mahler [mailto:[EMAIL PROTECTED]
Envoye : mardi 13 janvier 2004 17:41
A : OJB Users List
Objet : Re: Problem using strongly typed collections


Hi Guilaume,

Guillaume Nodet wrote:
> I've got an object model with strongly typed collections:
>
>       class A {
>               private BList bs;
>               public  BList getBs();
>       }
>
>       class B {
>               ...
>       }
>
>       class BList implements Collection {
>               ...
>       }
>
> When I store the object, everything is good, but when i read it later i've
> got an exception
> thrown from AbstractPersistentField.set when trying to set the B
collection,
> which is a
> ManageableCollection.

IMO the is caused by the fact that you Blist attribute is now filled
with a ManeageableCollection and not with BList!

You have to tell in the collection-descriptor that the "bs" attribute
must use a special collection-class="BList".

To make this work You BList must implement the interface
o.a.ojb.broker.ManageableCollection.

See tutorial 3 for more details.

> OJB was configured to use
> PersistentFieldDirectAccessImpl.
>
> So i tried with PersistentFieldIntrospectorImpl and adding a set method
>       public void setBs(Collection list)
> but I've got the following exception:
>       Can't get WriteMethod for property:bs in object:A
>
>
> Is there a way to store and read my collection without writing a custom
> PersistentField ?
>

IMO this is only a secondary error!

cheers,
thomas

> Guillaume Nodet
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to