[jboss-user] [JBoss Seam] - howto: selectManyMenu and hql with EntityQuery

thegernot do-not-reply at jboss.com
Mon Jun 18 05:00:36 EDT 2007


Hello,
I have used seam gen to generate basic classes for an existing database model. Now I try to add a listbox with multiple selection. The backend class is extended from EntityQuery.
The problem I have now:
How can I add a multiple selection restriction string for the query?

I have tried with a Long[] but the result is a class cast exception: the resulting select is not capable that he should receive a list but expects only one variable instead...


  | <h:selectManyMenu value="#{parameterList.categoryIds}">
  |    <s:selectItems value="#{paramcategoryList.resultList}" var="category" label="#{category.name}"/>
  |    <s:convertEntity />
  | </h:selectManyMenu>
  | 

  | @Name("parameterList")
  | public class ParameterList extends EntityQuery {
  |    private List<Long> categoryIds;
  | 
  |    private static final String[] RESTRICTIONS = {
  |       "parameter.paramcategory.id in elements(#{parameterList.categoryIds})",};
  | 
  |    @Override
  |    public String getEjbql() {
  |       return "select parameter from Parameter parameter";
  |    }
  | 
  |    @Override
  |    public List<String> getRestrictions() {
  |       return Arrays.asList(RESTRICTIONS);
  |    }
  |    
  |    ... categoryIds getter and setter
  | }
  | 

An additional problem arises with building RESTful URL's: since I have a dynamic list of parameters for the GET URL I have not found a solution to add a suitable page parameter to page.xml. As a work around I use the JSF POST...
Does anybody know how to add a page parameter that is capable of a selection list?

Many thanks,
Gernot


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

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



More information about the jboss-user mailing list