Olá Pessoal, boa tarde!
Estou com um problema ao retornar um json de uma lista de objetos.
Tenho o seguinte:
E quando acesso a página essa exception é disparada
13:26:27,982 DEBUG [DefaultExceptionMapper] find for exception class com.thoughtworks.xstream.core.TreeMarshaller$CircularReferenceException
10/07/2012 13:26:27 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
br.com.caelum.vraptor.InterceptionException: exception raised, check root cause for details: com.thoughtworks.xstream.core.TreeMarshaller$CircularReferenceException: Recursive reference to parent object
---- Debugging information ----
item-type : br.com.nextrans.erp.modelo.bean.Equipamento
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
[...]
Caused by: com.thoughtworks.xstream.core.TreeMarshaller$CircularReferenceException: Recursive reference to parent object
---- Debugging information ----
item-type : br.com.nextrans.erp.modelo.bean.Equipamento
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
-------------------------------
Meu modelo é o seguinte
@Entity
public class OrdemServico {
@Id @GeneratedValue
private Long idOrdemServico;
@Type(type = "org.joda.time.contrib.hibernate.PersistentLocalDateTime")
private LocalDateTime inicio = new LocalDateTime();
@Type(type = "org.joda.time.contrib.hibernate.PersistentLocalDateTime")
private LocalDateTime previsaoConclusao = new LocalDateTime();
@Type(type = "org.joda.time.contrib.hibernate.PersistentLocalDateTime")
private LocalDateTime conclusao;
@Enumerated(EnumType.STRING)
private StatusOrdemServico status = StatusOrdemServico.ABERTO;
private Double km;
@Column(length = 400)
private String obs;
@OneToOne
@JoinColumn
private Equipamento equipamento;
@OneToOne
@JoinColumn
private Filial filial;
@Enumerated(EnumType.STRING)
private TipoManutencao tipoManutencao;
@Enumerated(EnumType.STRING)
private TipoExecucaoServico tipoExecucao;
@OneToOne
@JoinColumn
private Funcionario mecanico;
@OneToOne
@JoinColumn
private Fornecedor fornecedor;
@ManyToMany
@JoinColumn
private List<GrupoTarefa> grupos = new ArrayList<GrupoTarefa>();
@OneToOne(cascade=CascadeType.ALL)
@JoinColumn
private Emissao emissao;
}
Eu não tenho a mínima ideia do que seja.
E com apenas include() no result json não resolve meu problema.