title: manual commits with @Transactional attribute
body: <p>I use spring+hibernate template to process entities. There is rather big amount of entities to be loaded all at once, so I retrieve an iterator from hibernate template.</p>
  
  <p>Every entity should be processed as a single unit of work. I tried to put entity processing in a separate transaction (propagation = REQUIRED_NEW). However I ended with exception stating that proxy is bounded to two sessions. This is due to suspended transaction used for iterator lazy loading. I am using the same bean for lazy loading and for processing entities. (May be it should be refactored into two separate daos: one for lazy loading and one for processing?)</p>
  
  <p>Then I tried to use single transaction that is committed after each entity is processed. Much better here, there are no exceptions during entity processing, but after processing is finished and method returns, exception is thrown from spring transaction managing code.</p>
  
  <pre><code>@Transactional
  public void processManyManyEntities() {
      org.hibernate.Sesstion hibernateSession = myDao.getHibernateTemplate().getSessionFactory().getCurrentSession();
      Iterator&lt;Entity&gt; entities = myDao.findEntitesForProcessing();
      while (entities.hasNext()) {
          Entity entity = entities.next();
          hibernateSession.beginTransaction();
          anotherBean.processSingleEntity(entity);
          hibernateSession.getTransaction().commit();
      }
  }
  </code></pre>
  
  <p><code>processSingleEntity</code> is a method in another bean annotated with <code>@Transactional</code>, so there is one transaction for all entities. I checked what transaction causes an exception: it is the very first transaction returned from <code>hibernateSession.beginTransaction()</code>, so it just not updated in transaction manager.</p>
  
  <p>There are several questions:</p>
  
  <p><strike>is it possible to avoid session bind exception without refactoring the dao?</strike> that is not relevant question as problem is with Session and hibernate not with dao</p>
  
  <p>is it possible to update transaction in the transaction manager? <strong>solved</strong></p>
  
  <p>is it possible to use the same transaction (for <code>anotherBean.processSingleEntity(entity);</code>) without <code>@Transactional</code> annotation on <code>processManyManyEntities</code>?</p>