title: Drools get facts from database at runtime
body: <p>I need a little help with Drools eval and variable assigning. </p>
  
  <pre><code>rule "check that no previously submitted requests exist"
  when
      $user : UserFormField( name == 'employeeId', value != null )
      $repository : Repository(  )
      $activeRequests : List( ) from $repository.findActiveRequestsByEmployee( $user.getValue() ) # call to repository
      eval( $activeRequests.size() &gt; 0 )
  then
      System.err.println(' You have active requests: ' + ((Request)$activeRequests.get(0)).getTitle);
      insert(Boolean.TRUE);
  end
  </code></pre>
  
  <p>In this rule I try to access repository and get active requests for current user. Rule compiles and executes without any exceptions or warnings. In debug mode it can be seen that repository returns non empty list and I expect to see console message 'You have active requests' but this doesn't happen. I think the problem is in this line</p>
  
  <pre><code>$activeRequests : List( ) from $repository.findActiveRequestsByEmployee( $user.getValue() )
  </code></pre>
  
  <p>because this rule works fine </p>
  
  <pre><code>rule "check that no previously submitted requests exist"
  when
      $user : UserFormField( name == 'employeeId', value != null )
      $repository : Repository(  )
      eval( $repository.findActiveRequestsByEmployee($user.getValue()).size() &gt; 0 )
  then
      System.err.println(' You have active requests !' );
      insert(Boolean.TRUE);
  end
  </code></pre>
  
  <p>So could someone point me how to solve this problem?</p>
  
  <p>Thanks! </p>