If you don't get an answer here you may want to ask on the JAXB list:
http://www.nabble.com/java.net---JAXB-f13496.html .

Glen

2008-07-03 Piotr Skawinski wrote:
> I have one entity with 2 bi-directional one-to-many relations and the 
> relations are the list with the objects of the same type as the parent object 
> like:
> 
> public class Institution implements Persistent  {
> 
>     @OneToMany(mappedBy = "uucInstitution", fetch=FetchType.EAGER)
>     @XmlElement(name="uucInstitution")
>     private List<Institution> uucInstitutions = new ArrayList<Institution>();
> 
>     @ManyToOne
>     @XmlTransient
>     private Institution uucInstitution;
>     
>     @OneToMany(mappedBy="attachedUUCInstitution", fetch=FetchType.EAGER)
>     @XmlElement(name="attachedUUCInstitution")
>     private List<Institution> attachedUUCInstitutions = new 
> ArrayList<Institution>();
>     
>     @ManyToOne
>     @XmlTransient
>     private Institution attachedUUCInstitution;
>     
>     @OneToMany(mappedBy="detachedUUCInstitution", fetch=FetchType.EAGER)
>     @XmlElement(name="detachedUUCInstitution")
>     private List<Institution> detachedUUCInstitutions;
>     
>     @ManyToOne
>     @XmlTransient
>     private Institution detachedUUCInstitution;
> 
> }
> 
> In this case the method 
> 
> public void afterUnmarshal(Unmarshaller u, Object parent) {
>     this.department = (Department)parent;
> 
> 
> seems problamatic to be used, because I need to unmarshall parent for both 
> relations institution-detachedUUCInstitutions and 
> institution-attachedUUCInstitutions.
> 
> Piotr
> 
> 
> 
> 
> > Date: Thu, 3 Jul 2008 09:58:00 -0400
> > From: [EMAIL PROTECTED]
> > Subject: Re: Cycle error in the object graph caused when returning jpa      
> > based objects
> > To: [email protected]
> > 
> > https://jaxb.dev.java.net/guide/Mapping_cyclic_references_to_XML.html ?
> > 
> > 2008-07-03 Piotr Skawinski wrote:
> > > Hi,
> > > 
> > > I'm getting "A cycle is detected in the object graph" error when a 
> > > web-service method returns jpa objects with bi-directional relations. The 
> > > objects are returned fine by the jpa's entity manager and the problem 
> > > occures first when the objects are being translated to some xml value by 
> > > the CXF. 
> > > 
> > > Any suggestion how to solve this problem?
> > > 
> > > Regards, Piotr
> > > 
> > > _________________________________________________________________
> > > Connect to the next generation of MSN Messenger 
> > > http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
> > 
> 
> _________________________________________________________________
> Connect to the next generation of MSN Messenger 
> http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline

Reply via email to