User: starksm 
  Date: 01/11/28 12:03:51

  Modified:    src/main/org/jboss/ejb/plugins/jaws/jdbc Tag: Branch_2_4
                        JDBCCreateEntityCommand.java
  Log:
  Handle FinderException from beanExistsCommand
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.6.3   +17 -8     
jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCCreateEntityCommand.java
  
  Index: JDBCCreateEntityCommand.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCCreateEntityCommand.java,v
  retrieving revision 1.6.6.2
  retrieving revision 1.6.6.3
  diff -u -r1.6.6.2 -r1.6.6.3
  --- JDBCCreateEntityCommand.java      2001/07/14 21:43:24     1.6.6.2
  +++ JDBCCreateEntityCommand.java      2001/11/28 20:03:50     1.6.6.3
  @@ -21,6 +21,7 @@
   
   import javax.ejb.CreateException;
   import javax.ejb.DuplicateKeyException;
  +import javax.ejb.FinderException;
   
   import org.jboss.ejb.EntityContainer;
   import org.jboss.ejb.EntityEnterpriseContext;
  @@ -38,7 +39,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Joe Shevland</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Justin Forder</a>
  - * @version $Revision: 1.6.6.2 $
  + * @version $Revision: 1.6.6.3 $
    */
   public class JDBCCreateEntityCommand
      extends JDBCUpdateCommand
  @@ -123,19 +124,27 @@
            }
            
            // Check duplicate
  -         if (beanExistsCommand.execute(id))
  +         try
            {
  -            throw new DuplicateKeyException("Entity with key "+id+" already 
exists");
  +             if (beanExistsCommand.execute(id))
  +             {
  +                throw new DuplicateKeyException("Entity with key "+id+" already 
exists");
  +             }
            }
  -         
  +         catch(FinderException e)
  +         {
  +            log.debug("Cound not determine existence:", e);
  +            throw new CreateException("Cound not determine existence:"+e);
  +         }
  +
            // Insert in db
  -         
            try
            {
               jdbcExecute(ctx);
  -         } catch (Exception e)
  +         }
  +         catch (Exception e)
            {
  -            log.debug(e);
  +            log.debug("Could not create entity:", e);
               throw new CreateException("Could not create entity:"+e);
            }
            
  @@ -143,7 +152,7 @@
            
         } catch (IllegalAccessException e)
         {
  -         log.debug(e);
  +         log.debug("Could not create entity:", e);
            throw new CreateException("Could not create entity:"+e);
         }
      }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to