I would rewrite your equals(), hashCode() and toString() methods so they
don't include any references to other objects, only to properties in the
object itself.

Matt

On Mon, Dec 22, 2008 at 5:08 AM, agathon <n...@schoenhouse.de> wrote:

>
> hey matt,
> first it has nothing to do with axis but with xfire :thinking:
>
> i am now getting the infinite reference loop by collections
>
> here is the first class:
>
> public class ErrorModel extends BaseObject implements Serializable {
>
>    public ErrorModel(){}
>
>        @Id @GeneratedValue(strategy=GenerationType.AUTO)
>        private Long id;
>
>        @Column(name="title",nullable=false,length=255)
>        private String title;
>
>        @Column(name="description",nullable=false,length=255)
>        private String description;
>
>        @OneToMany( mappedBy = "error",fetch=FetchType.EAGER)
>        private Set<SolutionModel> solutions = new HashSet<SolutionModel>();
>
>
>        getters setters....
>
>
>
>    public String toString() {
>       return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
>                .append("id", this.id)
>                .toString();
>    }
>    @Override
>        public int hashCode() {
>                //final int prime = 31;
>                //int result = this.hashCode();
>                //result = prime * result + ((id == null) ? 0 :
> id.hashCode());
>                return id.hashCode();
>        }
>
>
>        @Override
>        public boolean equals(Object o) {
>                if (this == o) {
>            return true;
>        }
>        if (!(o instanceof ErrorModel)) {
>            return false;
>        }
>
>        final ErrorModel error = (ErrorModel) o;
>
>        return !(this.id != null ? !id.equals(error.getId()) :
> error.getId()
> != null);
>        }
>
>
> }
>
> --------------------------------------------------------------------------------------
> here is the second:
>
>
> @Entity
> @Table(name="solutions")
> public class SolutionModel extends BaseObject implements Serializable {
>
>        public SolutionModel() { }
>
>        @Id @GeneratedValue(strategy=GenerationType.AUTO)
>        private Long id;
>
>        @Column(name="title",nullable=false,length=100)
>        private String title;
>
>        @ManyToOne
>        @JoinColumn(name="error")
>        private ErrorModel error;
>
>        @ManyToOne
>        @JoinColumn(name="category")
>        private SolutionCategoryModel category;
>
>        @Column(name="solution_date")
>        @Temporal(TemporalType.DATE)
>        private Date date;
>
>        @Column(name="description",nullable=false,length=255)
>        private String description;
>
>        @Column(name="rating",nullable=false,length=255)
>        private Integer rating;
>
>
>        getters setters ...
>
>
>    public String toString() {
>        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
>                .append("id", this.id)
>                .toString();
>    }
>    @Override
>        public int hashCode() {
>                //final int prime = 31;
>                //int result = this.hashCode();
>                //result = prime * result + ((id == null) ? 0 :
> id.hashCode());
>                return id.hashCode();
>        }
>
>
>        @Override
>        public boolean equals(Object o) {
>                if (this == o) {
>            return true;
>        }
>        if (!(o instanceof ErrorModel)) {
>            return false;
>        }
>
>        final SolutionModel s = (SolutionModel) o;
>
>        return !(this.id != null ? !id.equals(s.getId()) : s.getId() !=
> null);
>        }
>
>
> }
>
>
>
>
>
>
>
>
> this here is my responseString ....
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
>         xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>         <soap:Body>
>                <ns1:findByTitleResponse xmlns:ns1="http://service.omq.de";>
>                        <ns1:out>
>                                <ns2:ErrorModel xmlns:ns2="
> http://model.omq.de";>
>                                        <description xmlns="
> http://model.omq.de";>kytx</description>
>                                        <id xmlns="http://model.omq.de
> ">-2</id>
>                                        <solutions xmlns="
> http://model.omq.de";>
>                                                <SolutionModel>
>                                                        <category>
>                                                                <id>-2</id>
>
>  <label>error</label>
>
>  <labelIcon></labelIcon>
>
>  <parentCategory xsi:nil="true" />
>                                                        </category>
>
>  <date>2008-12-20T00:00:00+01:00</date>
>
>  <description>iuvluyv</description>
>                                                        <error>
>
>  <description>kytx</description>
>                                                                <id>-2</id>
>                                                                <solutions>
>
>  <SolutionModel>
>
>    <category>
>
>            <id>-2</id>
>
>            <label>error</label>
>
>            <labelIcon></labelIcon>
>
>            <parentCategory xsi:nil="true" />
>
>    </category>
>
>    <date>2008-12-20T00:00:00+01:00</date>
>
>    <description>iuvluyv</description>
>
>    <error>
>
>            <description>kytx</description>
>
>            <id>-2</id>
>
>            <solutions>
>
>                    <SolutionModel>
>
>                            <category>
>
>                                    <id>-2</id>
>
>                                    <label>error</label>
>
>                                    <labelIcon></labelIcon>
>
>                                    <parentCategory xsi:nil="true" />
>
>                            </category>
>
>                            <date>2008-12-20T00:00:00+01:00</date>
>
>                            <description>iuvluyv</description>
>
>                            <error>
>
>
>
>
> is the hashCode and equals right?
>
>
> --
> View this message in context:
> http://www.nabble.com/axis-stackoverflow-tp21091534s2369p21126749.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>
>

Reply via email to