users@jax-ws.java.net

Re: Circular relationship problems with jaxb and jax-ws

From: Fernando Parisotto <fernando.parisotto_at_gmail.com>
Date: Mon, 30 Oct 2006 21:17:41 -0300

Hy Dima,
I add the @XmlTransient annotation like you write, in the same place and I
steel get the same exception...
I using JDK 1.5 update 9, and SJSAS 9.
And I read the
https://jaxb.dev.java.net/guide/Mapping_cyclic_references_to_XML.html follow
this instruction and dont work too.
I really dont know what to do, please help...

2006/10/30, Dima Gutzeit <dima_at_mailvision.com>:
>
> Do you need the relationship to be bi-directional in the schema as well ?
> If not, you can eliminate one direction by adding @XmlTranisent annotation,
> like this:
>
> @XmlTransient
> @ManyToOne
> private Categoria categoria;
>
> ----- Original Message -----
> *From:* Fernando Parisotto <fernando.parisotto_at_gmail.com>
> *To:* users_at_jax-ws.dev.java.net
> *Sent:* Monday, October 30, 2006 10:18 PM
> *Subject:* Circular relationship problems with jaxb and jax-ws
>
> Hy every one,
> I have 2 classes,
>
> -------------------------------------------------------------------
> package net.uniplac.tcc.segurancaws.model;
> // imports...
> public class Categoria implements Serializable {
>
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY)
> private Integer id;
>
> @Column(nullable=false, unique = true)
> private String nome;
>
> private String unidade;
>
> @OneToMany(mappedBy = "categoria")
> private Set<Produto> produtos;
>
> // gets and sets
>
> }
> ---------------------------------------------------------------
> and
> ---------------------------------------------------------------
> package net.uniplac.tcc.segurancaws.model;
> public class Produto implements Serializable {
>
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY )
> private Integer id;
>
> private String nome;
>
> private Double precoUnitario;
>
> private int qdtEstoque;
>
> @ManyToOne
> private Categoria categoria;
>
> // gets and sets
>
> }
>
> And I have some serios problems to expose this classes into a Web
> Services.
> I have this exceptions:
>
> javax.xml.soap.SOAPException: javax.xml.bind.MarshalException
> - with linked exception:
> [com.sun.istack.SAXException2: A cycle is detected in the object graph.
> This will cause infinitely deep XML: Mogno -> Door-> Mogno]
> java.lang.RuntimeException: javax.xml.soap.SOAPException:
> javax.xml.soap.SOAPException : javax.xml.bind.MarshalException
> - with linked exception:
> [com.sun.istack.SAXException2: A cycle is detected in the object graph.
> This will cause infinitely deep XML: Mogno -> Door-> Mogno]
>
> What can I do to avoid this circular relation erros on marshal my object
> graph?
>
> Please help, thanks for all.
> --
> Fernando Luiz Parisotto
>
>


-- 
Fernando Luiz Parisotto