Thanks for the replies, but this didn't solve my issue. I've tried before
and after the db.begin() without visible results;

As I stated I'm pretty convinced this issue has something to do with the
way sub-objects are stored. Regardless I use the -type j2 swith or not the
generated classes will store their "collections" in Arrays.

When I try using the org.exolab.castor.builder.extraCollectionMethods=true
option in castorbuilder.properties and re-run the generator, I actually
get some extra methods in my generated classes, i.e. getActorAsReference()
which returns a Collection and allows me to access my "Actor" list
through, for instance, iterators, and this is fine.

However the "internal" management of this objects lists keeps stayin in
Arrays in the generated classes, so that then when a persistent Object,
i.e. my Movie object which I previously loaded with a OQL select is
subsequently deleted with db.remove(movie), the jdo will try to traverse
the array of Actors and remove them. This is the point when the
java.lang.UnsupportedOperationException is thrown because Arrays have no
remove method supported and the
org.exolab.castor.persist.ClassMolder$1$ArrayIterator.remove will ALWAYS
throw such an exception (I checked the code).

As far as I understand this is a bit of an inconsistency between the JDO
framework and the Source Generator, meaning that Source-Generator
generated classes may not be used in a JDO framework when you have
collections, unless you customize the code by hand.

Am I missing something crucial ?

Thanks anyway.
Piero

> Niko Efthymiou wrote:
>> try db.setAutoStore(true); after db.begin().
>>
>
>  From
> http://castor.exolab.org/api/org/exolab/castor/jdo/Database.html#setAutoStore(boolean):
> " This method should be called before begin()."
>
> Stein
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to