2 Replies Latest reply on Oct 25, 2007 5:03 AM by Manu Osten

    Problem with transaction

    Manu Osten Apprentice

      Hello,

      Two methodes from plain java class should access into requetBean to fetch/store the data into/from db. At the transaction issue, the second methode "findUserGroup" cannot be called, because it are already in the active transaction. Have you an idea to solve that problem?

      Error message:


      "Caused by: java.lang.reflect.UndeclaredThrowableException
      at $Proxy407.createRawRequest(Unknown Source)
      at de.kirchedlau.ponte.utils.convertExceltoDB.sheetToRawRequest(convertExceltoDB.java :121)
      at de.kirchedlau.ponte.utils.convertExceltoDB.sheetToEntity(convertExceltoDB.java:102)
      ...
      ...

      Caused by: java.io.NotSerializableException: de.kirchedlau.ponte.ejb.entities.admin.UserGroup
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
      ...
      ...
      ...


       // methode is called
       private void sheetToRawRequest(Sheet sheet) {
       RequestInterface requestSession = (RequestInterface) sessionhandler.requestSession;// adresse of RequestBean
      
       if (requestSession == null) {
       System.out.println("RequestInterface authsession does not exist");
       return;
       }
       requestSession.deleteAllRawRequests(); // Access to methode of bean
      
       for (int i = 0; i < sheet.getRows(); i++) {
      
       Cell[] row = sheet.getRow(i);
       RawRequest request = rowToRawRequest(row); // that methode is called and more above
       if (request != null) {
       requestSession.createRawRequest(request); // Accessing the methode of requestBean
       System.out.println("RawRequest added: " + request.getAbout());
       } else {
       System.out.println("Error in line " + i);
       }
       }
       }
      
       private RawRequest rowToRawRequest(Cell[] row)
       {
       RawRequest request = new RawRequest();
       ...
       ...
       ...
      
       // Column 12: Group
       if(numOfColumns > 11){
       UserGroup userGroup = requestsession.findDefaultUserGroup(); // Access to RequestBean. That is problem
       request.setUserGroup(userGroup); // Es definiert auch in der RequestInterface
       }
       return request;
       }
      


      Thank you in advance

      Manu