title: Hibernate session update not working
body: <p>Here the date stored in the MySQL database is not updating even after execution of the update query. I have checked sql query by setting show_sql=true. Here HBHelper is a class that has static method for creating new session. It is working properly with other updates but only this class has some problem.</p>
  
  <pre><code> package com.mbs.hibernate;
   import java.util.ArrayList;
   import org.hibernate.Query;
   import org.hibernate.Session;
   import com.mbs.model.Show;
  
  public class UpdateShowAfterPayService {
  
    public boolean updateShow(String id, int count, ArrayList&lt;Integer&gt; pos) {
      // TODO Auto-generated method stub
      Session session = HBHelper.openSession(); // static methods which create session
      try {
          session.getTransaction().begin();
          Query q = session.createQuery("from Show where show_id=?");
          q.setString(0, id);
          Show show = (Show) (q.list()).get(0);
          StringBuilder sb = new StringBuilder(show.getCurrent_pattern());
          int booked = show.getBooked_seats();
          booked += count;
          for (int i = 0; i &lt; pos.size(); i++) {
              sb.setCharAt(pos.get(i) ,'2');
          }
          System.out.println("booked.."+booked);
          show.setBooked_seats(booked);
          show.setCurrent_pattern(sb.toString()); 
          session.update(show);
          session.flush();
          session.getTransaction().commit();
          System.out.println("updated......");
          return true;
      } catch (Exception e) {
          System.out.println(e);
          return false;
      } finally {
          session.close();
      }
  
  }
  }
  </code></pre>
  
  <p>This is hbm.xml for the Show class</p>
  
  <pre><code>     &lt;hibernate-mapping&gt;
      &lt;class name="com.mbs.model.Show" table="shows"&gt;
  
      &lt;id name="show_id" type="string" length="50"&gt;
          &lt;column name="SHOW_ID" /&gt;
      &lt;/id&gt;
  
      &lt;property name="show_date" type="date"&gt;
          &lt;column name="SHOW_DATE"&gt;&lt;/column&gt;
      &lt;/property&gt;
  
      &lt;property name="show_time" type="time"&gt;
          &lt;column name="SHOW_TIME"&gt;&lt;/column&gt;
      &lt;/property&gt;
  
  
      &lt;property name="vip_cost" type="integer"&gt;
          &lt;column name="VIP_COST"&gt;&lt;/column&gt;
      &lt;/property&gt;
  
      &lt;property name="exe_cost" type="integer"&gt;
          &lt;column name="EXE_COST"&gt;&lt;/column&gt;
      &lt;/property&gt;
  
      &lt;property name="normal_cost" type="integer"&gt;
          &lt;column name="NORMAL_COST"&gt;&lt;/column&gt;
      &lt;/property&gt;
  
      &lt;property name="booked_seats" type="integer"&gt;
          &lt;column name="BOOKED_SEATS" default="0"&gt;&lt;/column&gt;
      &lt;/property&gt;
  
      &lt;property name="current_pattern" type="text"&gt;
          &lt;column name="CUR_PATTERN"&gt;&lt;/column&gt;
      &lt;/property&gt;
      &lt;many-to-one name="mov" class="com.mbs.model.Movie"
          column="MOVIE_ID" not-null="true" lazy="false" cascade="all"&gt;&lt;/many-to-one&gt;
  
      &lt;many-to-one name="audi" class="com.mbs.model.Auditorim"
          column="AUDI_ID" not-null="true" lazy="false" cascade="all"&gt;&lt;/many-to-one&gt;
  
  &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>