2 Replies Latest reply on Feb 8, 2007 5:28 AM by jameswoodward

    FlushMode.MANUAL being ignored???

      Hi,

      I recently purches the eBook "Java Persistence with Hibernate" and am working through the chapters.

      Why is it that this code reports a flushMode of AUTO, when it should be MANUAL?

      @Stateful
      public class MySessionBean implements MySession {
      
       private static final Log log = LogFactory.getLog(MySessionBean.class);
      
       @PersistenceContext(type=PersistenceContextType.EXTENDED, properties=@PersistenceProperty(name="org.hibernate.flushMode", value="MANUAL"))
       private EntityManager entityManager;
      
       @EJB
       private CounterDAO counterDAO;
      
       public void test() {
       org.jboss.ejb3.entity.HibernateSession hs = (org.jboss.ejb3.entity.HibernateSession) entityManager;
       org.hibernate.Session session = hs.getHibernateSession();
       org.hibernate.FlushMode flushMode = session.getFlushMode();
       log.info(flushMode);
      
       for (int i = 0; i < 100; i++) {
       Integer value = counterDAO.increment(threadName);
       }
       }
      
       public void flush() {
       entityManager.flush();
       }
      
       @Remove
       public void destroy() {
       log.info("FtpSessionBean.destroy()");
       }
      }