[jboss-user] [JBoss Seam] - EntityQuery and s:selectItems ???

terryb do-not-reply at jboss.com
Thu Oct 18 07:25:37 EDT 2007


Please help, I can't seem to get "h:selectOneMenu using s:selectItems and s:convertEntity" working with EntityQuery. My search pages is based on seam-gen's MyEntityList example.

i am not sure if it is even possible?

I have oneToMany between User and UserSecurityRole. On the UserSecurityRole search page, I would have a pulldown list with all users. I would simply like to restrict UserSecurityRole results to the value selected in User pulldown.


  | My JSF:
  | <h:selectOneMenu value="#{userSecurityRoleList.userSecurityRole.user}" id="user">
  |  <s:selectItems value="#{userAll.resultList}" var="user" label="#{user.username}" noSelectionLabel="All users"/>
  |  <s:convertEntity />
  | </h:selectOneMenu>
  | 
  | 
  | Component.xml
  | <framework:entity-query name="userAll" 
  |     ejbql="select u from User u"
  |     order="username">
  | </framework:entity-query>
  | 
  | 
  | UserSecurityRoleList.java
  | @Name("userSecurityRoleList")
  | public class UserSecurityRoleList extends EntityQuery {
  | 	
  | 	private static final String[] RESTRICTIONS = {
  | 		"lower(userSecurityRole.id) like concat('%',lower(#{userSecurityRoleList.userSecurityRole.id}),'%')",
  | 		"lower(userSecurityRole.user.id) like concat('%',lower(#{userSecurityRoleList.user.id}),'%')", 
  | 	};
  | 	
  | 	private UserSecurityRole userSecurityRole = new UserSecurityRole();
  | 
  | 	@Override
  | 	public String getEjbql() {
  | 		return "select userSecurityRole from UserSecurityRole userSecurityRole";
  | 		
  | 	}
  | 
  | 	@Override
  | 	public Integer getMaxResults() {
  | 		return 25;
  | 	}
  | 
  | 	public UserSecurityRole getUserSecurityRole() {
  | 		return userSecurityRole;
  | 	}
  | 
  | 	@Override
  | 	public List<String> getRestrictions() {
  | 		return Arrays.asList(RESTRICTIONS);
  | 	}
  | }
  | 

I don't get any errors, but my selection is ignored. I think I loose user pulldown value in UserSecurityRoleList. I could really use some help here.

Thanks!




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

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



More information about the jboss-user mailing list