0 Replies Latest reply on May 11, 2006 11:56 AM by amit

    how to split to 2 transactions in ejb3 method

    amit Newbie

      Hibernate version:
      hibernate 3.1 + ejb3.

      Hi.
      I have a method in ejb3 stateless bean, which I'm tring to split there the initial transaction to two transactions.
      meaning:

      
      public @Stateless class XXXBean {
      
      @PersistenceContext(unitName="ImagineDB")
      private EntityManager manager;
      
      public void someMethod() {
       Dog dog = new Dog(); //dog is an entity bean;
       manager.persist(dog);
       manager.flush();
       //here I want new transaction
       manager.getTransaction().commit(); //this commands fails
       Cat cat = new Cat();
       manager.persist(cat);
      
      }
      
      }
      
      


      Thanks in advance, amit