The StackOverflowError usually happens when you're referring to child
objects in your equals() and hashCode() methods that in turn refer
back to the parent object. I'd suggest not using the Equals and
HashCode builders because I believe they do this by default. You could
also look and see if they allow you to exclude certain properties.

Matt

On 8/20/07, fadhli <[EMAIL PROTECTED]> wrote:
> It's a bidirectional pojo with other entities.
>
> package com.dnt.miti.model;
>
> import java.util.Date;
> import java.util.HashSet;
> import java.util.Set;
>
> import javax.persistence.AttributeOverride;
>  import javax.persistence.AttributeOverrides;
> import javax.persistence.CascadeType;
> import javax.persistence.Column;
> import javax.persistence.Embedded;
> import javax.persistence.Entity;
> import javax.persistence.FetchType ;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> import javax.persistence.OneToMany;
> import javax.persistence.Table;
> import javax.persistence.Temporal ;
> import javax.persistence.TemporalType;
>
> import org.apache.commons.lang.builder.EqualsBuilder;
> import org.apache.commons.lang.builder.HashCodeBuilder;
> import org.apache.commons.lang.builder.ToStringBuilder ;
> import org.apache.commons.lang.builder.ToStringStyle;
> import org.hibernate.annotations.GenericGenerator;
>
> /**
>  * @author Fadhli
>  *
>  */
> @Entity
> @Table(name="MITI_MAIN")
> public class MitiMain extends MitiBaseObject {
>     private static final long serialVersionUID = 6274442145165414974L;
>     private String appId;
>     private String referenceNo;
>     private String endorsementNo;
>     private String appType;
>     private String appStatus;
>     private String appTransactionType;
>     private String appCase;
>     private String traderCode;
>     private String applicationMode;
>     private String counterNo;
>     private Date effectiveDate;
>     private Date expiryDate;
>     private String branchCode;
>     private Date appDate;
>     private String companyName;
>     private MitiAddress companyAddress;
>     private String phoneNo;
>     private String mobileNo;
>     private String faxNo;
>     private String email;
>     private String declarantName;
>     private String declarantDesignation;
>     private String declarantIcNo;
>     private String declarantPhoneNo;
>     private Date declarationDate;
>     private String traderRefNo;
>     private Date approveDate;
>     private Character notificationType;
>     private String notificationEmail;
>     private String authFormDApplicant;
>     private String authFormDDesignation;
>     private String authFormDIcNo;
>     private Set<MitiFinishedProduct> finishedProducts = new
> HashSet<MitiFinishedProduct>();
>     private Set<MitiTransactions> mitiTransactions = new
> HashSet<MitiTransactions>();
>     private Set<MitiFormDDetail> mitiFormDDetails = new
> HashSet<MitiFormDDetail>();
>
>     /**
>      * No-arg constructor for JavaBean tools.
>      */
>     public MitiMain(){}
>
>     /**
>      * Database Identifier
>      * @return appId (primary key)
>      */
>     @Id
>     @GeneratedValue(generator = "system-uuid")
>     @GenericGenerator(name = "system-uuid", strategy = "uuid")
>     @Column(name = "MM_APP_ID")
>     public String getAppId() {
>         return appId;
>     }
>
>     @Column(name = "MM_REFERENCE_NO", length = 30)
>     public String getReferenceNo() {
>         return referenceNo;
>     }
>
>     @Column(name = "MM_ENDORSEMENT_NO", length = 30)
>     public String getEndorsementNo() {
>         return endorsementNo;
>     }
>
>     @Column(name = "MM_APP_TYPE", length = 30)
>     public String getAppType() {
>         return appType;
>     }
>
>     @Column(name = "MM_APP_STATUS", length = 3)
>     public String getAppStatus() {
>         return appStatus;
>     }
>
>      @Column(name = "MM_APP_TRANSACTION_TYPE", length = 3)
>     public String getAppTransactionType() {
>         return appTransactionType;
>     }
>
>     @Column(name = "MM_APP_CASE", length = 10)
>     public String getAppCase() {
>         return appCase;
>     }
>
>     @Column(name = "MM_TRADER_CODE", length = 15)
>     public String getTraderCode() {
>         return traderCode;
>     }
>
>     @Column(name = "MM_APPLICATION_MODE", length = 1)
>     public String getApplicationMode() {
>         return applicationMode;
>     }
>
>     @Column(name = "MM_COUNTER_NO", length = 15)
>     public String getCounterNo() {
>         return counterNo;
>     }
>
>     @Temporal(TemporalType.TIMESTAMP)
>     @Column(name = "MM_EFFECTIVE_DATE")
>     public Date getEffectiveDate() {
>          return effectiveDate;
>     }
>
>     @Temporal(TemporalType.TIMESTAMP)
>     @Column(name = "MM_EXPIRY_DATE")
>     public Date getExpiryDate() {
>         return expiryDate;
>     }
>
>      @Column(name = "MM_BRANCH_CODE", length = 3)
>     public String getBranchCode() {
>         return branchCode;
>     }
>
>     @Temporal(TemporalType.TIMESTAMP)
>     @Column(name = "MM_APP_DATE")
>     public Date getAppDate() {
>         return appDate;
>     }
>
>     @Column(name = "MM_COMPANY_NAME", length = 35)
>     public String getCompanyName() {
>         return companyName;
>     }
>
>     @Embedded
>     @AttributeOverrides( {
>             @AttributeOverride(name = "address1", column = @Column(name =
> "MM_COMPANY_ADDRESS1", length = 35)),
>             @AttributeOverride(name = "address2", column = @Column(name =
> "MM_COMPANY_ADDRESS2", length = 35)),
>             @AttributeOverride(name = "address3", column = @Column(name =
> "MM_COMPANY_ADDRESS3", length = 35)),
>             @AttributeOverride(name = "city", column = @Column(name =
> "MM_CITY", length = 30)),
>             @AttributeOverride(name = "state", column = @Column(name =
> "MM_STATE", length = 30)),
>             @AttributeOverride(name = "countryCode", column = @Column(name =
> "MM_COUNTRY_CODE", length = 3)),
>             @AttributeOverride(name = "countryDesc", column = @Column(name =
> "MM_COUNTRY_DESC", length = 30)),
>             @AttributeOverride(name = "postCode", column = @Column(name =
> "MM_POST_CODE", length = 10)) })
>     public MitiAddress getCompanyAddress() {
>         return companyAddress;
>     }
>
>     @Column(name = "MM_TELEPHONE_NO", length = 15)
>     public String getPhoneNo() {
>         return phoneNo;
>     }
>
>     @Column(name = "MM_MOBILE_NO", length = 15)
>     public String getMobileNo() {
>         return mobileNo;
>     }
>
>     @Column(name = "MM_EMAIL", length = 15)
>     public String getEmail() {
>         return email;
>     }
>
>     @Column(name = "MM_FAX_NO", length = 15)
>     public String getFaxNo() {
>         return faxNo;
>     }
>
>     @Column(name = "MM_DECL_NAME", length = 50)
>     public String getDeclarantName() {
>         return declarantName;
>     }
>
>     @Column(name = "MM_DECL_DESIGN", length = 30)
>     public String getDeclarantDesignation() {
>         return declarantDesignation;
>     }
>
>     @Column(name = "MM_DECL_IC_NO", length = 16)
>     public String getDeclarantIcNo() {
>         return declarantIcNo;
>     }
>
>     @Column(name = "MM_DECL_PHONE_NO", length = 15)
>     public String getDeclarantPhoneNo() {
>         return declarantPhoneNo;
>     }
>
>     @Temporal(TemporalType.TIMESTAMP)
>     @Column(name = "MM_DECL_DATE")
>     public Date getDeclarationDate() {
>         return declarationDate;
>     }
>
>     @Column(name = "MM_TRADER_REF_NO", length = 30)
>     public String getTraderRefNo() {
>         return traderRefNo;
>     }
>
>     @Temporal(TemporalType.TIMESTAMP )
>     @Column(name = "MM_APPROVED_DATE")
>     public Date getApproveDate() {
>         return approveDate;
>     }
>
>     @Column(name = "CAD_NOTIFICATION_TYPE", length = 1)
>     public Character getNotificationType() {
>         return notificationType;
>     }
>
>     @Column(name = "CAD_NOTIFICATION_EMAIL", length = 30)
>     public String getNotificationEmail() {
>         return notificationEmail;
>     }
>
>     @Column(name = "CAD_AUTH_FORMD_APPLICANT", length = 10)
>     public String getAuthFormDApplicant() {
>         return authFormDApplicant;
>     }
>
>     @Column(name = "CAD_AUTH_FORMD_DESIGN", length = 3)
>     public String getAuthFormDDesignation() {
>         return authFormDDesignation;
>     }
>
>     @Column(name = "CAD_AUTH_FORMD_IC_NO", length = 20)
>     public String getAuthFormDIcNo() {
>         return authFormDIcNo;
>     }
>
>     @OneToMany(fetch = FetchType.LAZY,
>                 cascade ={CascadeType.PERSIST, CascadeType.MERGE,
> CascadeType.REMOVE},
>                mappedBy="mitiMain")
>
> @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN
> )
>     public Set<MitiFinishedProduct> getFinishedProducts() {
>         return finishedProducts;
>     }
>
>     /**
>      * To Add MitiFinishedProduct to MitiMain
>      * @param MitiFinishedProduct finishProduct
>      */
>     public void addMitiFinishedProduct(MitiFinishedProduct
> finishProduct){
>         if(finishProduct == null)
>             throw new IllegalArgumentException("Can't add a null Finished
> Product!");
>         finishProduct.setMitiMain(this); //Set the inverse side to this
> object (MitiMain)
>         this.getFinishedProducts().add(finishProduct);
>     }
>
>     @OneToMany(fetch = FetchType.LAZY,
>                cascade ={ CascadeType.PERSIST, CascadeType.MERGE,
> CascadeType.REMOVE},
>                mappedBy="mitiMain")
>
> @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
>     public Set<MitiTransactions> getMitiTransactions() {
>         return mitiTransactions;
>     }
>
>     /**
>      * To Add MitiTransactions to MitiMain
>      * @param MitiTransactions mitiTx
>      */
>     public void addMitiTransaction(MitiTransactions mitiTx)
> {
>         if(mitiTx == null)
>             throw new IllegalArgumentException("Can't add null
> MitiTransaction object");
>         mitiTx.setMitiMain(this);
>         this.getMitiTransactions().add(mitiTx);
>     }
>
>     @OneToMany(fetch = FetchType.LAZY,
>                cascade ={CascadeType.PERSIST, CascadeType.MERGE,
> CascadeType.REMOVE},
>                mappedBy="mitiMain")
>     @org.hibernate.annotations.Cascade
> (org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
>     public Set<MitiFormDDetail> getMitiFormDDetails() {
>         return mitiFormDDetails;
>     }
>
>     /**
>      * To Add MitiFormDDetail to MitiMain
>      * @param MitiFormDDetail formDdetail
>      */
>     public void addMitiFormDDetail(MitiFormDDetail
> formDdetail) {
>         if(formDdetail == null)
>             throw new IllegalArgumentException("Can't add null
> MitiTransaction object");
>         formDdetail.setMitiMain(this);
>         this.getMitiFormDDetails().add(formDdetail);
>     }
>
>     public void setMitiFormDDetails(Set<MitiFormDDetail>
> mitiFormDDetails) {
>         this.mitiFormDDetails = mitiFormDDetails;
>     }
>
>     public void setMitiTransactions(Set<MitiTransactions>
> mitiTransactions) {
>         this.mitiTransactions = mitiTransactions;
>     }
>
>     public void
> setFinishedProducts(Set<MitiFinishedProduct>
> finishedProducts) {
>         this.finishedProducts = finishedProducts;
>     }
>
>     public void setAppId(String appId) {
>         this.appId = appId;
>     }
>
>     public void setAppCase(String appCase) {
>         this.appCase = appCase;
>     }
>     public void setTraderCode(String traderCode) {
>         this.traderCode = traderCode;
>     }
>
>     public void setApplicationMode(String applicationMode) {
>         this.applicationMode = applicationMode;
>     }
>     public void setApproveDate(Date approveDate) {
>         this.approveDate = approveDate;
>     }
>     public void setAppStatus(String appStatus) {
>         this.appStatus = appStatus;
>     }
>     public void setAppTransactionType(String appTransactionType) {
>         this.appTransactionType = appTransactionType;
>     }
>     public void setAppType(String appType) {
>         this.appType = appType;
>     }
>     public void setAuthFormDApplicant(String authFormDApplicant) {
>         this.authFormDApplicant = authFormDApplicant;
>     }
>     public void setAuthFormDDesignation(String authFormDDesignation) {
>          this.authFormDDesignation = authFormDDesignation;
>     }
>     public void setAuthFormDIcNo(String authFormDIcNo) {
>         this.authFormDIcNo = authFormDIcNo;
>     }
>     public void setBranchCode(String branchCode) {
>         this.branchCode = branchCode;
>     }
>     public void setCompanyAddress(MitiAddress companyAddress) {
>         this.companyAddress = companyAddress;
>     }
>     public void setCompanyName(String companyName) {
>         this.companyName = companyName;
>     }
>     public void setCounterNo(String counterNo) {
>         this.counterNo = counterNo;
>     }
>     public void setDeclarantDesignation(String declarantDesignation) {
>         this.declarantDesignation = declarantDesignation;
>     }
>     public void setDeclarantIcNo(String declarantIcNo) {
>         this.declarantIcNo = declarantIcNo;
>     }
>     public void setDeclarantName(String declarantName) {
>         this.declarantName = declarantName;
>     }
>     public void setDeclarantPhoneNo(String declarantPhoneNo) {
>         this.declarantPhoneNo = declarantPhoneNo;
>     }
>     public void setDeclarationDate(Date declarationDate) {
>         this.declarationDate = declarationDate;
>     }
>     public void setEffectiveDate(Date effectiveDate) {
>         this.effectiveDate = effectiveDate;
>     }
>     public void setEmail(String email) {
>          this.email = email;
>     }
>     public void setEndorsementNo(String endorsementNo) {
>         this.endorsementNo = endorsementNo;
>     }
>     public void setExpiryDate(Date expiryDate) {
>         this.expiryDate = expiryDate;
>     }
>     public void setFaxNo(String faxNo) {
>         this.faxNo = faxNo;
>     }
>     public void setMobileNo(String mobileNo) {
>         this.mobileNo = mobileNo;
>     }
>     public void setNotificationEmail(String notificationEmail) {
>         this.notificationEmail = notificationEmail;
>     }
>     public void setNotificationType(Character notificationType) {
>         this.notificationType = notificationType;
>     }
>     public void setPhoneNo(String phoneNo) {
>         this.phoneNo = phoneNo;
>     }
>     public void setReferenceNo(String referenceNo) {
>         this.referenceNo = referenceNo;
>     }
>     public void setTraderRefNo(String traderRefNo) {
>         this.traderRefNo = traderRefNo;
>     }
>     public void setAppDate(Date appDate) {
>         this.appDate = appDate;
>     }
>
>     /**
>      * <p>When using Hibernate w/ entities mapped with assigned keys, the
>      * equals/hashCode methods should include the members corresponding
>      * to the assigned key which is known as the business key</p>
>      *
>      * <p>A business key is a property, or some combination of properties,
>      * that is unique for each instance with the same database identity.
>      * Unlike a natural primary key, it isn't an absolute requirement
>      * that the business key never changes—as long as it changes rarely,
>      * that's enough</p>
>      *
>      * <p>A business key can also be an information that has meaning to
>      * the real world. For instance : username is a good biz key as
>      * it cannot be change or change rarely</p>
>      *
>      * <p>This would ensure that the object created is consistent at
>       * all times with respect to its identity.</p>
>      *
>      * @see java.lang.Object#equals(Object)
>      */
>     public boolean equals(Object object) {
>         if (this == object) return true;
>         if (!(object instanceof MitiMain)) {
>             return false;
>         }
>         MitiMain rhs = (MitiMain) object;
>         return new EqualsBuilder().append(this.referenceNo,
> rhs.referenceNo).isEquals();
>     }
>
>     /**
>      * @see java.lang.Object#hashCode ()
>      */
>     public int hashCode() {
>         return new HashCodeBuilder(-2029089885,
> 17027211).append(this.referenceNo).toHashCode();
>     }
>
>     /**
>      * Returns the string representation of this object
>      * @see java.lang.Object#toString()
>      */
>     public String toString() {
>         return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
>             .append("endorsementNo",this.endorsementNo )
>             .append("declarantDesignation",this.declarantDesignation)
>             .append("declarantName",this.declarantName)
>             .append("notificationEmail",this.notificationEmail )
>             .append("faxNo", this.faxNo)
>             .append("counterNo", this.counterNo)
>             .append("appId", this.appId)
>             .append("declarantPhoneNo", this.declarantPhoneNo)
>             .append("authFormDDesignation", this.authFormDDesignation)
>             .append("applicationMode", this.applicationMode)
>             .append("email", this.email)
>             .append("mobileNo", this.mobileNo)
>             .append("authFormDApplicant", this.authFormDApplicant)
>             .append("traderCode", this.traderCode)
>             .append("companyAddress", this.companyAddress)
>             .append("declarantIcNo",this.declarantIcNo)
>             .append("notificationType",this.notificationType)
>             .append("traderRefNo", this.traderRefNo )
>             .append("appStatus",this.appStatus)
>             .append("phoneNo", this.phoneNo)
>             .append("appCase", this.appCase)
>             .append("referenceNo", this.referenceNo)
>             .append("authFormDIcNo",this.authFormDIcNo)
>             .append("appType", this.appType)
>             .append("companyName", this.companyName)
>             .append("branchCode", this.branchCode)
>             .append("appTransactionType", this.appTransactionType)
>             .toString();
>     }
> }
>
>
>
> On 8/20/07, Matt Raible <[EMAIL PROTECTED]> wrote:
> >
> > What's the code from your POJO look like?
> >
> > Matt
> >
> > On 8/20/07, fadhli <[EMAIL PROTECTED]> wrote:
> > > Hello everyone, Matt,
> > >
> > > I'm using Appfuse 2-05m with Spring MVC Basic.
> > >
> > > I'm having this problem during consuming my web services. How do I avoid
> > > circular references in appfuse 2?
> > >
> > > I'm getting this error
> > >
> > > Exception in thread "main" java.lang.StackOverflowError
> > >     at
> > >
> sun.util.calendar.ZoneInfo.getOffsets(ZoneInfo.java:215)
> > >     at
> > >
> java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1998)
> > >     at
> > >
> java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1970)
> > >     at
> > > java.util.Calendar.setTimeInMillis(Calendar.java:1066)
> > >     at java.util.GregorianCalendar.<init>(GregorianCalendar.java :576)
> > >     at
> java.util.Calendar.createCalendar(Calendar.java:968)
> > >     at java.util.Calendar.getInstance(Calendar.java:924)
> > >     at
> > >
> org.codehaus.xfire.util.date.XsDateTimeFormat.parseObject(XsDateTimeFormat.java
> :275)
> > >      at java.text.Format.parseObject(Format.java:219)
> > >     at
> > >
> org.codehaus.xfire.aegis.type.basic.DateTimeType.readObject(DateTimeType.java:39)
> > >     at
> > > org.codehaus.xfire.aegis.type.basic.BeanType.readObject
> (BeanType.java
> > > :159)
> > >     at
> > >
> org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:159)
> > >
> > > --
> > > /fadhli
> >
> >
> > --
> > http://raibledesigns.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> /fadhli


-- 
http://raibledesigns.com

Reply via email to