title: Handling multiple values for a single query parameter in a rest webservice url and handling them using hibernate criteria
body: <p>I have a rest web service which would accept 'name' and fetch the tokens from the db with this name and return the tokens back.
  The url for the rest webservice would be:</p>
  
  <pre><code>http://localhost:8080/NameService/Tokens?name=Bob
  </code></pre>
  
  <p>and in the serviceLayer, I have my method as follows:</p>
  
  <pre><code>@GET
  @Path("Tokens")
  @Produces("application/xml")
  public JAXBElement&lt;GetToken&gt; getokenByName(@QueryParam("name") final String name ) {
  
      if(name!=null){
          // use hibernate criteria to fetch the records from db
          Criteria crit = getSession().createCriteria(getPersistentClass());
          crit.add(Restrictions.eq("name",name))
      }
  }
  </code></pre>
  
  <p>Now we have a change in requirement when the client can send multiple names in the request at the same time.For example, give me the tokens where name = "bob" or "brendon" or "aaron"
  The URL could be like this:</p>
  
  <pre><code>http://localhost:8080/NameService/Tokens?name=Bob,Aaron,Brendon
  </code></pre>
  
  <p>The number of names sent is variable. It can be 1 or 2 or 3 so on. 
  Any ideas on how to achieve this split and passing them to hibernate criteria as an OR condition in the service layer by tweaking the code shown above, which works for one name?</p>
  
  <p>One way might be to use <code>StringUtils</code> to parse out the different names using delimiter (comma) and then form a list and some how adding the names in the list to criteria restrictions. But not sure if this works.</p>
  
  <p>Any ideas?</p>