0 Replies Latest reply on Nov 25, 2007 7:12 AM by paata lominadze

    CMT and EJB 3 Question (Urgent).

    paata lominadze Master

      hi all,
      i have simplest ejb 3 session bean :

      @Stateless
      @Remote(TestFasade.class)
      public class TestFasadeBean implements TestFasade {
      
       @PersistenceContext(unitName = "Oracle")
       EntityManager oracleManager;
      
       @TransactionAttribute(TransactionAttributeType.REQUIRED)
       public Long create() {
       try {
       System.out.println("start creating");
       Test test = comit();
       Thread.sleep(10000);
       System.out.println("end creating");
       return test.getId();
       } catch (Exception e) {
       e.printStackTrace();
       return 0L;
       }
       }
      
       @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
       public Test comit() {
       try {
       System.out.println("start persisting");
       Test test = new Test();
       test.setAge(21L);
       test.setName("adsdasd");
       test.setSurname("asdasd");
       oracleManager.persist(test);
       oracleManager.flush();
       System.out.println("end persisting");
       return test;
       } catch (Exception e) {
       e.printStackTrace();
       return null;
       }
       }
      }
      

      i need that after a comit() method information must be visible into database, this is not work. i see information into database after 10 second. why ? can anybody help?
      is it possible to do by transaction demarcation? or how i can do it ?

      i need to flush information after commit method ends.

      any idea will be appreciated.

      ______________
      Regards,
      Paata.