3 Replies Latest reply on Nov 20, 2009 7:42 AM by Nicklas Karlsson

    using Hibernate manual flush with ConversationScoped bean

    Arbi Sookazian Master

      from 5.3.1. Conversation demarcation ref doc:


      @ConversationScoped @Stateful
      public class OrderBuilder {
      private Order order;
      private @Inject Conversation conversation;
      private @PersistenceContext(type = EXTENDED) EntityManager em;
      @Produces public Order getOrder() {
      return order;
      }
      public Order createOrder() {
      order = new Order();
      conversation.begin();
      return order;
      }
      public void addLineItem(Product product, int quantity) {
      order.add(new LineItem(product, quantity));
      }
      public void saveOrder(Order order) {
      em.persist(order);
      conversation.end();
      }
      @Remove
      public void destroy() {}
      }



      assuming JPA 2.0 with Hibernate persistence provider, how can I use manual flush in this example? 


      In Seam I can do:


      @Begin(join=true, flushMode=FlushModeType.MANUAL)



      So is this possible with Weld/JPA2 or must I use Seam3?