[jboss-user] [JBoss Seam] - Re: s:selectItems problems Seam 2 Beta1

smithbstl do-not-reply at jboss.com
Thu Aug 30 12:41:07 EDT 2007


Ok, I got it working.  I was not outjecting the department or departmentSection entities which was a problem.

I also had to rewrite the equals() method of DepartmentSection

public boolean equals(Object other) {
  |     if (other == null) {
  | 	return false;
  |     } 
  |     if (other instanceof DepartmentSection) {
  | 	DepartmentSection that = (DepartmentSection) other;
  | 	if (that.getDepartmentSectionId() != null && this.getDepartmentSectionId() != null) {
  | 	    return this.departmentSectionId.equals(that.departmentSectionId);
  | 	} else {
  | 	    return (this == that);
  | 	}
  |     } else {
  | 	return false;
  |     }	
  | }

Since jsf does not guarantee how many times equals() will be called, it was being called 3 times during process validations but it was passing null objects in for "other" and at other times seam was passing proxy objects that were not null but the fields were not initialized.  

Is there a more concise way to cover all the bases with equals()?  Or should implement a similar method on all my entities?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079695#4079695

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079695



More information about the jboss-user mailing list