title: Hibernate Update Query is not working in second time
body: <p>I am trying to update record by Hibernate HQL Query but result in continue loading page.</p>
  
  <p>There is no any problem with update record at first attempt.</p>
  
  <p>For Mapping I am using annotation configuration, @Transactional is bind in service layer,  </p>
  
  <p>Hibernate Configuration in Spring configuration file :</p>
  
  <pre><code>    &lt;mvc:annotation-driven/&gt;
      &lt;tx:annotation-driven /&gt;
      &lt;context:component-scan base-package="com.spring.datasolr"/&gt;
  
      &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="locations"&gt;
              &lt;list&gt;
                  &lt;value&gt;classpath:application.properties&lt;/value&gt;
                  &lt;value&gt;classpath:db.properties&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;mvc:resources mapping="/resources/**" location="/WEB-INF/resources/"/&gt;
  
      &lt;!-- Configures spring view resolver --&gt;
      &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/views/"/&gt;
          &lt;property name="suffix" value=".jsp"/&gt;
      &lt;/bean&gt;
  
      &lt;!-- Configures validation message property file --&gt;
      &lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;
          &lt;property name="basename" value="/WEB-INF/messages"&gt;&lt;/property&gt;
      &lt;/bean&gt;
  
          &lt;!-- Configures database property --&gt;
          &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt;
              &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt;
              &lt;property name="url" value="${jdbc.url}"/&gt;
              &lt;property name="username" value="${jdbc.username}"/&gt;
              &lt;property name="password" value="${jdbc.password}"/&gt;
          &lt;/bean&gt;
  
          &lt;!-- Configures Hibernate Sessionfactory --&gt;
          &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
              &lt;property name="dataSource" ref="dataSource"/&gt;
              &lt;property name="packagesToScan"&gt;
                  &lt;list&gt;
                      &lt;value&gt;com.spring.datasolr.model&lt;/value&gt;
                  &lt;/list&gt;
              &lt;/property&gt;
  
              &lt;property name="hibernateProperties"&gt;
                  &lt;props&gt;
                      &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                      &lt;!-- &lt;prop key="hibernate.hbm2ddl.auto"&gt;create&lt;/prop&gt; --&gt;
                  &lt;/props&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;!-- Configures Hibernate Transaction Management --&gt;
          &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
              &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
          &lt;/bean&gt; 
  </code></pre>
  
  <p>Dao Class :</p>
  
  <pre><code>@Autowired
      SessionFactory sessionFactory;
  
      private Session getSession(){
          return sessionFactory.openSession();
      }
  
      @Override
          public void update(User user) {
          System.out.println("User ID :: "+user.getId());
          Query query = getSession().createQuery("UPDATE User SET name=:name, email=:email, message=:message WHERE id=:id");
          query.setParameter("name", user.getName());
          query.setParameter("email", user.getEmail());
          query.setParameter("message", user.getMessage());
          query.setParameter("id", user.getId());
          query.executeUpdate();
          //sessionFactory.openSession().saveOrUpdate(user);
      }
  </code></pre>
  
  <p>Service Layer :</p>
  
  <pre><code>@Transactional
  @Service(value = "userService")
  public class UserServiceImpl implements UserService {
      @Autowired
      UserDAO userDao; // This is for database
  
      @Autowired
      SolrTemplate solrTemplate;
  
      @Resource
      private UserRepository userRepository; // This is for solr
  
      @Override
      public void updateDocument(Object obj) {
          User user =(User) obj;
          userDao.update(user);
  
          //solr repository, save all user in solr indexing
          userRepository.save(userDao.userList());
      }
  }
  </code></pre>