3

enter code hereHi Guys me and some classmates are working on a project for school and are stuck with this error: a cycle is detected in the object graph this will cause infinitely deep xml.

This is our code

@Entity
public class Client extends User implements Serializable {
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date birthdate;
    private String address;
    private String zipcode;
    private String city;
    private String phone;
    private String info;
    private boolean active;
    @OneToMany(mappedBy = "client")
    private List<Cartrack> cartrac

And this is our cartrack object:

@Entity
public class Cartrack implements Serializable {

    @Id
    private String id;
    @OneToOne(  mappedBy = "cartrack", 
                cascade = CascadeType.ALL,
                fetch = FetchType.EAGER
            )
    private Vehicle vehicle;
    @ManyToOne
    private Client client;

And last but not least the vehicle object:

@Entity
public class Vehicle implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String licenseNr;
    private boolean stolen;
    @OneToOne
    private Cartrack cartrack;

All object have their setters and getters, and still after hours of research and reading tons of documentation we're still unable to fix the problem.

Our last hope is Stackoverflow!

Thanks in advance!

4

1 回答 1

0

问题解决了。

我们有一个双向关系,显然 XML 无法以我们需要的正确方式处理。因此,这可能更多地被视为人为错误,因为不需要这种关系。

通过删除这种关系,SOAP 能够再次发送数据。

感谢您与我们一起思考!

于 2013-04-22T12:19:34.210 回答