2 Replies Latest reply on Jan 19, 2007 11:34 AM by pmuir

    Injecting Entity Queries into beans

    pmuir

      At the moment you can inject an EntityQuery into a component

      @Name("foo")
      public class Foo {
      
       @In(create=true)
       private EntityQuery barQuery;
      
       ...
      
       public void foo() {
       Iterator it = barQuery.getResultList().getIterator();
       while (it.hasNext()) {
       Bar bar = (Bar) it.next();
       ...
       }
       }
      
      }


      but it would be much neater (IMO) if you could just inject the results of the query

      @Name("foo")
      public class Foo {
      
       @In(create=true, value="barQuery.resultList")
       private List<Bar> bars;
      
       ...
      
       public void foo() {
       for (Bar bar : bars) {
       ...
       }
       }
      
      }


      Am I missing an obvious way to do this?