 <p>Look at the query:</p> <pre><code>from HeadCategory where headCategoryName=Cash In Hand </code></pre> <p>That's not a valid query at all. What is Cash? What is Hand? A correct query would be</p> <pre><code>from HeadCategory where headCategoryName='Cash In Hand' </code></pre> <p>Learn to pass parameters correctly and safely to queries:</p> <pre><code>session.createQuery("from HeadCategory where headCategoryName = :name") .setString("name", headCategoryName) .list(); </code></pre>