[jboss-user] [JBoss Seam] - Re: org.jboss.seam.ui.entityConverter not working with set o

chandu_great do-not-reply at jboss.com
Fri Oct 26 10:40:40 EDT 2007


Hi,

The relevant xhtml fragment is shown below.

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:s="http://jboss.com/products/seam/taglib"
        xmlns:c="http://java.sun.com/jstl/core"
        xmlns:v="http://myTest.com/core"	
        xmlns:a="https://ajax4jsf.dev.java.net/ajax">

	<s:div rendered="#{empty rendered or rendered}">
              <s:validateAll>                  
                      <c:choose>
		      .....
		      .....
                          <c:when test="#{listStyle eq 'entityCheck'}">
                                <h:selectManyCheckbox value="#{value}"
                                      converter="org.jboss.seam.ui.EntityConverter"
                                      layout="pageDirection">
                                      <f:selectItems value="#{v:toSelectItems(pickList)}" />
                                      <f:attribute name="valueChangeListener"
                                            value="#{valueChangeListenerMethod}"
                                            rendered="#{not empty valueChangeListenerMethod}" />
                                </h:selectManyCheckbox>
                          </c:when>
		      .....
		      .....
                      </c:choose>                  
              </s:validateAll>
        </s:div>
</ui:composition>

The problem occurs when I try to save a user record. A user can be assigned multiple roles( listStyle eq 'entityCheck' as shown in xhtml above). 
The User class looks like:
public class User implements Serializable{

	protected String username; // assigned primary key

	//@IndexColumn(base=1,name="roles")
    //protected List roles = new ArrayList();
	protected Set roles = new HashSet();
	
	@Id
	@Column(unique = true)
	@Length(min = 5, max = 40)
	public String getUsername() {
		return username;
	}

	public String getPassword() {
		return password;
	}

	@ManyToMany
	public Set getRoles() {
		return roles;
	}

	public void addRole(Role role) {
		getRoles().add(role);
		role.addUser(this);
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public void setRoles(Set roles) {
		this.roles = roles;
	}

	public void setGroups(Set groups) {
		this.groups = groups;
	}	
}

Thanks,
Chandra


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

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



More information about the jboss-user mailing list