[jboss-user] [JBoss Seam] - Re: Programatic example for Query Objects

jimk1723 do-not-reply at jboss.com
Tue Dec 12 20:27:53 EST 2006


This may not be what you're looking for, but here's a sample where I'm using an EntityQuery to populate an auto-complete list of names (forgive any syntax errors, I cribbed this from my working code, but changed the names.). 



  | @In(required = false)
  | Person examplePerson;
  | 
  | @Out(required = false)
  | EntityQuery people;
  | 
  | @Factory("people")
  | public void refreshPeople() {
  | 
  |  List<String> restrictions = new ArrayList<String>();
  |  restrictions.add("lower(name) like lower( #{examplePerson.name} || '%' )");
  | 
  |  people = new EntityQuery();
  |  people.setEjbql("from Person");
  |  people.setOrder("name");
  |  people.setMaxResults(10);
  |  people.setRestrictions(restrictions);
  | }



  | <h:inputText value="#{examplePerson.name}">
  |  <a4j:support event="onkeyup" reRender="autocompletePeople" action="#{personHome.refreshPeople}" requestDelay="100" />
  | </h:inputText>
  | 
  | <a4j:outputPanel id="autocompletePeople">
  | <ul>
  |  <ui:repeat value="#{people.resultList}" var="p">
  |   <li>
  |    <h:outputText value="#{p.name}" />
  |   </li>
  |  </ui:repeat>
  | </ul>
  | </a4j:outputPanel>
  | 



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

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



More information about the jboss-user mailing list