0 Replies Latest reply on Feb 18, 2005 5:15 PM by Pascale Simus

    Problem with the transactions inside JBOSS 3.2.3

    Pascale Simus Newbie

      Hi everybody !

      We are developping a J2EE application and we have big problems with the transactions.
      We are searching many documentations and every day we are learning lots of interesting things but... currently, we have decided to change the finders into the DAO for a performance reason (we are using another driver to connect to SQLServer2000 : JTDS1.0.2 --> excellent driver).

      But the problem is that if one creates or updates entities and then just after a query DAO is executed to get back the data whose state has just changed, we don't receive them.
      Correctly! Because the DAO is called inside of a session bean's method with trans-attribute "required". Thus the data is not yet committed.

      Unfortunately, i can't to provide you ejb-jar.xml, jboss.xml because the files of our application are in my workplace but i'm going to show an example :


      JournalDelegate
      
      public Collection determineValidJournals(String logonId) throws SystemException{
       try{
       return getSessionFacade().determinevalidJournals(logonId);
       } catch (RemoteException re) {
       throw new SystemException(.......);
       }
      }
      
      
      
      JournalSessionFacadeObject --> EJBObject
      
      public Collection determineValidJournals(String logonId) throws SystemException, RemoteException;
      
      
      
      JournalSessionFacade --> SessionBean
      
      public Collection determineValidJournals(String logonId) throws SystemException {
       return getSessionBean().determineValidJournals(logonId);
      }
      
      
      
      
      JournalSessionBeanObject --> EJBlocalObject
      
      public Collection determineValidJournals(String logonId) throws SystemException;
      
      
      
      JournalSessionBean --> SessionBean
      
      public Collection determineValidJournals(String logonId) throws SystemException {
       Iterator it = findAllFinancialCentersByVerifier(logonId);
       Collection coll = new ArrayList();
       while (it.hasNext()){
       FinancialCenterVO fc = (FinancialCenterVO) it.next();
       validateJournal(fc);
       coll.addAll(findValidJournals(fc)); --> This last method causes a problem
       }
       return coll;
      }
      
      
      public void validateJournal(fc) throws SystemException{
       Iterator it = findCheckableJournals(fc);
       while (it.hasNext()){
       JournalVO journal = (JournalVO) it.next();
       update data into DB after check of datas validity by findByPrimaryKey(......).setValueObject(journal);
       }
      }
      
      



      ejb-jar.xml

      Only the local Session beans and Entity Beans methods are in "REQUIRED", NOT the session facades methods.



      To resolve the fastest way, we want to put the findValidJournals(.....) in determineValidJournals(....) of SessionFacade. But JBoss has decided to put this method into a transaction !!!


      In fact, that doesn't resolve our problem --> So that method has been put into JournalDelegate. But this is abnormal --> 2 network calls


      Why does JBoss automatically make a transaction ????

      Does a tag exist to modify this behavior ????


      Thank for your time :-)


      Pascale