0 Replies Latest reply on Mar 3, 2003 12:50 PM by Erik Turesson

    Calling CMP from Session bean

    Erik Turesson Novice

      Hello!

      I am using Jboss 3.0.6.
      I have some session beans that calls my entity beans.
      For example I have one called FolderManager that mostly handles my Folder entity beans. One called UserManager that handles my User entity beans.

      To lookup my entity beans I have implementet private session bean method that looks like below.

      private FolderLocal getFolderLocal(long folder)
      throws FolderDoesntExistException{
      try{
      return folderLocalHome.findByPrimaryKey(new FolderPK(new Long(folder)));
      }
      catch (FinderException e){
      throw(new FolderDoesntExistException(folder));
      }
      }

      However if I need to get a FolderLocal object in my UserManager session bean I have one private method that looks exactly the same in that session bean too.

      My question is:
      Is this a good way of solving it or is it better to have only one implementation in the FolderManager session bean. That implementation will then publish a local interface. One obvious bad thing with the first solution is that you get the same code in several places.

      My question is also if it has any effect on performance and bean locking if you choose the first or the second way.

      /Erik