title: Drools fetch same type of object from session
body: <p>I have Simple Rule in which i have insert two String type of variable in Session. now i need to fetch variables.</p>
  
  <p>Code For same: </p>
  
  <pre><code>rule "Header Account Null Check"
      dialect "java"
      ruleflow-group "TB:Header Account Null Check"
      when
          cAccount : AccountPair( headerAccount == null )     
      then
          String error=new String();
          String validateMsg=new String();
          error="2528";
          validationMsg="Header Account must not be null"
          modify( cAccount ) {
                  setErrorCode( "2528" )
          }
          insert(error);
          insert(validateMsg);
          System.out.println("Header Account null check called");
  end
  
  query "fetch validation variables"
      #conditions
      s:String();
  end
  </code></pre>
  
  <p>Java Code:</p>
  
  <pre><code>Collection&lt;Object&gt; myfacts = kSession.getObjects( new ClassObjectFilter(String.class) );
  </code></pre>
  
  <p>After checking in <strong>myfacts i got two values.</strong></p>
  
  <p>Now the problem is there are two variables with String.class Type, I need to know which value is for <strong>error</strong> and which value is for <strong>validationMsg</strong> so that we will perform next task.</p>
  
  <p>Same with Input also if we add two String variable from Session now i need to add condition on those variable. so same problem also occur for same.till now we resolved input variable problem by declaring variable as a <strong>Global Variable</strong>. I also need to change this strategy because its not a good decision for declaring global variable.</p>
  
  <p>Please help me out.</p>