users@glassfish.java.net

RE: CycleRecoverable any good illustrations?

From: Kenneth Clark <kenneth.clark_at_skyetech.co.za>
Date: Thu, 27 Dec 2007 23:23:09 +0200

Thanks. Appreciate the feedback :)

So when is a good time to implement the CycleRecoverable interface?

________________
Thanks and regards

Kenneth Clark
Solutions Engineer


Tel: 27 (0) 11 679 3075
Fax: 27 (0) 86 647 4819
Mobile: 27 (0) 84 583 1348
Email: kenneth.clark_at_skyetech.co.za
Website: http://www.skyetech.co.za

-----Original Message-----
From: Sanjeeb.Sahoo_at_Sun.COM [mailto:Sanjeeb.Sahoo_at_Sun.COM] On Behalf Of
Sahoo
Sent: 27 December 2007 09:37
To: users_at_glassfish.dev.java.net
Subject: Re: CycleRecoverable any good illustrations?

I think an effective, portable strategy is to use @XmlTransient and
Marshal event callbacks (beforeMarshal & afterMarshal).

Thanks,
Sahoo

Kenneth Clark wrote:
>
> Hi all. I have been fighting with the infamous “cycle in XML graph”
> issue described in http://forums.java.net/jive/thread.jspa?threadID=13670
>
>
>
> I used to manually code the break in the graph but this is leading to
> errors as the current object model I am working with effectively
> references all the data in all the objects which leads to a stack of
> cycles.
>
>
>
> I came across the CycleRecoverable interface and thought it was a
> rather nifty idea. The only problem I am having is that I have no clue
> as to the best way to use this interface. In the initial idea by
> gadams00 the onCycleDetected function allowed for the passing of the
> object into the function their by allowing the instantiation of the
> object with the properties.
>
>
>
> Is the implementation of the onCycleDetected method supposed to be
> something along the lines of
>
>
>
> @Entity
>
> Public class MyObject implements Serializable, CycleRecoverable {
>
> Private String id;
>
>
>
> Public MyObject(String id){
>
> This.id = id
>
> }
>
>
>
> public Object onCycleDetected(CycleRecoverable.Context context) {
>
> MyObject obj = new MyObject(this.id);
>
> return obj;
>
> }
>
> }
>
>
>
> (Excuse the incorrect syntax, it is 3am and I don’t feel like fighting
> with the auto messer upper of the email client)
>
>
>
> I have tried the @XmlTransient but the example only provides one
> relationship and there is nothing on ManyToMany relationships. Any
> help in the direction of examples of the best way to implement the
> CycleRecoverable would be greatly appreciated. The primary purpose of
> the serialization of these objects is for transmission using web services.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> ________________
>
> Thanks and regards
>
>
>
> *Kenneth Clark*
>
> Solutions Engineer
>
>
>
> ShadowLogo.png
>
> *Tel:** *27 (0) 11 679 3075
>
> *Fax: *27 (0) 86 647 4819
>
> *Mobile:** *27 (0) 84 583 1348
>
> *Email:** *_kenneth.clark_at_skyetech.co.za
> <mailto:kenneth.clark_at_skyetech.co.za>_
>
> *Website:** *http://www.skyetech.co.za**
>
>
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.17.9/1197 - Release Date:
> 2007/12/25 20:04
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.17.11/1200 - Release Date: 2007/12/27
13:34
 

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.17.11/1200 - Release Date: 2007/12/27
13:34