Re: [Simple-support] CyclicStrategy throws CycleException: Invalid reference 'p101.a' found
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2008-05-07 18:19:52
|
Hi,
This is true, however there is a reason for this and
that is that because each object is issued a validate
and commit callback using the @Validate and @Commit.
If the object is not fully deserialized then it can
not process the commit and validate correctly.
There is a work around and that is to deserialize
everything first queue the objects and references and
resolve them in traversal order. This however has the
side effect that everything must be deserialized first
before the objects are validated. So for very large
documents this is a little wasteful considering some
details might be invalid and the deserialization can
be terminated early. Perhaps this is a reasonable
compromise between functionality and correctness
though. Ill consider it for the next release.
Niall
--- Benoît Pointet <ben...@un...> wrote:
> Hi,
>
> I have the following cross-reference situation :
>
> <apples>
> <apple id="a1">
> <cake ref="c1">
> </apple>
> </apples>
> <cakes>
> <cake id="c1">
> <apple ref="a1">
> </cake>
> </cakes>
>
> And I thought that including a CyclicStrategy would
> do deserialize it
> into two objects, each being a member field of the
> other:
>
> strategy = new CycleStrategy("id", "ref");
> serializer = new Persister(strategy);
>
> However,
> the first reference (<cake ref="c1">) is not
> resolved and a
> CycleException is thrown.
>
> So it looks like Cycles are only meant to "go
> backward", not forward ?
>
> thanks,
> b.
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008
> JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still
> time to save $100.
> Use priority code J8TL2D2.
>
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
>
https://lists.sourceforge.net/lists/listinfo/simple-support
>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
|