[jboss-user] [JBoss Seam] - [2.0.0.CR1] selectManyListbox + convertEntity yields convers

Jeilong do-not-reply at jboss.com
Mon Oct 1 09:49:25 EDT 2007


When selecting two items from selectManyListbox I get the following validation error:
anonymous wrote : Conversion Error setting value '7 9' for '#{workgroupSelectedStudents}'.

Evidently person with Id 7 and 9 were selected, but what is causing this validation error? I tried overriding equals() and to match objects on their @Id field. This yielded the same result. Can anyone shed some light on this? I am deploying this on Jboss 4.2.0.GA and Seam 2.0.0.GA.

addStudent.xhtml

  | <s:validateAll>
  |   <h:outputLabel for="studentlist" value="Pick students" />
  |   <h:selectManyListbox id="studentlist" size="14" required="true" value="#{workgroupSelectedStudents}">
  |     <s:selectItems value="#{workgroupAvailableStudents}" var="student" label="#{student.firstName} #{student.prefix} #{student.lastName}"/>
  |     <s:convertEntity/>
  |   </h:selectManyListbox>
  | </s:validateAll>
  | 

WorkgroupStudentDetail.java

  | @Stateful
  | @Name("workgroupStudentManager")
  | @Scope(ScopeType.CONVERSATION)
  | @Conversational
  | public class WorkgroupStudentDetail implements WorkgroupStudentDetailInterface {
  | 	@In
  | 	private EntityManager entityManager;
  | 
  | 	@In(required = false)
  | 	@Out(required = false)
  | 	private Collection<Person> workgroupAvailableStudents;
  | 		
  | 	@Out(required = false, scope = ScopeType.CONVERSATION)
  | 	private Collection<Person> workgroupSelectedStudents;
  | 	
  | 	@Begin (join = true, flushMode = FlushModeType.MANUAL)
  | 	@Factory("workgroupAvailableStudents")
  | 	public void findStudents() {
  | 		try {
  | 			workgroupAvailableStudents = (Collection<Person>) entityManager.createQuery("SELECT DISTINCT Object(per) FROM Person per").getResultList();
  | 		} catch (Exception e) {
  | 			log.error("Exception occurred in findStudents() [WorkgroupStudentDetail].", e);
  | 		}
  | 	}
  | 
  | 	// ..
  | }
  | 


Person.java

  | @Entity
  | @Table(name = "person")
  | public class Person implements Serializable {
  | 	
  | 	private static final long serialVersionUID = 7690407363935244693L;
  | 	private Long personId;
  | 	private School school;
  | 	private String firstName;
  | 	private String prefix;
  | 	private String lastName;
  | 	private Gender gender;
  | 	private Date dateOfBirth;
  | 	private String placeOfBirth;
  | 	private String mobile;
  | 	private String email;
  | 	private String nationality;
  | 	private String edexKey;
  | 	private String pgnoNumber;
  | 	private Date startDate;
  | 	private Date endDate;
  | 	private Boolean active;
  | 	private Boolean critical;
  | 	
  | 	@Override
  | 	public String toString() {
  | 		return getPersonId() == null ? null : getPersonId().toString(); 
  | 	}
  | 	
  | 	@Id
  | 	@GeneratedValue(strategy = GenerationType.IDENTITY)
  | 	@Column(name = "person_id")
  | 	public Long getPersonId() {
  | 		return personId;
  | 	}
  | 	
  | 	protected void setPersonId(Long personId) {
  | 		this.personId = personId;
  | 	}
  | // ..
  | 

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

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



More information about the jboss-user mailing list