title: GWT Request Factory - Multiple queries for collection from the "ServiceLayerDecorator.isLive()" - method
body: <p>I had the problem, that every time i retrieved a collection from the gwt request factory, there was the "findEntity()"-method called for every entity in that collection. And this "findEntity()"-method calls the SQL-Database.</p>
  
  <p>I found out that this happens because request factory checks the "liveness" of every entity in the "ServiceLayerDecorator.isLive()"-method (also described here: <a href="https://stackoverflow.com/questions/6083346/requestfactory-and-findentity-method-in-gwt">requestfactory and findEntity method in GWT</a>)</p>
  
  <p>So i provided my own RequestFactoryServlet: </p>
  
  <pre><code>public class MyCustomRequestFactoryServlet extends RequestFactoryServlet {
  
  
      public MyCustomRequestFactoryServlet() {
          super(new DefaultExceptionHandler(), new MyCustomServiceLayerDecorator());
  
      }
  
  }
  </code></pre>
  
  <p>And my own ServiceLayerDecorator:</p>
  
  <pre><code>public class MyCustomServiceLayerDecorator extends ServiceLayerDecorator {
  
      /**
       * This check does normally a lookup against the db for every element in a collection
       * -&gt; Therefore overridden
       */
      @Override
      public boolean isLive(Object domainObject) {
          return true;
      }
  }
  </code></pre>
  
  <p>This works so far and I don't get this massive amount of queries against the database.</p>
  
  <p>Now I am wondering if I will get some other issues with that? Or is there a better way to solve this?</p>