title: How to use where condition for a column which contains comma delimited values using Hibernate and mysql
body: <p>Used arraylist in where clause for a column as below with <strong>Hibernate</strong> and <strong>MYSQL</strong>.</p>
  
  <pre><code>List&lt;String&gt; list=new ArrayList&lt;String&gt;();
  list.add("name1");
  list.add("name2");
  list.add("name3");
  
  String query= "from TEST where name in (:names)";
  Query q = s.createQuery(hql);
  q.setParameterList("names", list);
  </code></pre>
  
  <p>But need to implement the same where condition for a column which is comma delimited values.
  All the records has to be shown if any value from this column presents in arraylist </p>
  
  <p><strong>Table Structure</strong></p>
  
  <pre><code>ID   NAME
  ----------
  1   name1,name2,name3
  2   name1
  3   name2,name3
  4   name5,name8
  5   name3,name6
  </code></pre>
  
  <p><strong>Expected result:</strong></p>
  
  <p>records with id <strong>1,2,3,5</strong> has to be displayed.</p>
  
  <p><strong>Problem Statement:</strong>
  I want to use Hibernate criteria with restrictions and i have arraylist to use in where clause and we can't use 
  <strong>Restrictions.in("name",list);</strong> 
  because this name column contains comma delimited values and we need to check if any of element from arraylist is a part of data in this column.</p>