users@glassfish.java.net

Infinite XML Loop

From: Kenneth Clark <kenneth_at_rabiddog.co.za>
Date: Fri, 10 Aug 2007 12:24:56 +0200

Hi guys

 

I have a bi-directional relationship and everytime I try and fetchAll I am
getting the error

“com.sun.istack.SAXException2: A cycle is detected in the object graph. This
will cause infinitely deep XML:”

 

The mapping in the AccountType class is:

 

  @OneToMany(mappedBy = "accountType", fetch=FetchType.LAZY)

  private Collection<EntityAccountInformation>
entityAccountInformationCollection;

 

And the mapping in the EntityAccountInformation is

  @ManyToOne

  @JoinColumn(name = "account_type_id", referencedColumnName = "id")

  private AccountType accountType;

 

Do I have to remove the bidirectional relationship to resolve this? Why is
it ignoring the FetchType?

I enabled the toplink.weaving property (read that it might stop this)

<property name="toplink.weaving" value="true"/>

 

But nothing seems to be helping.

 

Any feed back would be great

 

Thanks

 

Kenneth Clark
Solution Architect / Lead Developer
Rabid Dog Labs


Tel: +27 11 475 7409

Mobile: +27 82 500 5090
Email: kennethHYPERLINK "mailto:kenneth_at_rabiddog.co.za"@rabiddog.co.za
Web: HYPERLINK "http://www.rabiddog.co.za/"http://www.rabiddog.co.za

 


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.476 / Virus Database: 269.11.11/944 - Release Date: 2007/08/09
14:44