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);
}
}