Package javax.ejb

Examples of javax.ejb.DuplicateKeyException


      try {
         Object id = idField.get(ctx.getInstance());
        
         // Check exist
         if (getFile(id).exists())
            throw new DuplicateKeyException("Already exists: "+id);
        
         // Store to file
         storeEntity(id, ctx.getInstance());
        
         return id;
View Full Code Here


         }
         catch(SQLException e)
         {
            if("23000".equals(e.getSQLState()))
            {
               throw new DuplicateKeyException("Unique key violation or invalid foreign key value: pk=" + ctx.getId());
            }
            else
            {
               throw new CreateException("Failed to create instance: pk=" +
                  ctx.getId() +
View Full Code Here

            try {
              stmt.setInt(1, id);
              ResultSet rs = stmt.executeQuery();
              try {
                 if (rs.next())
                    throw new DuplicateKeyException("EntityExc id " + pk.intValue() +
                                                    " already in database.");
               } finally {
                  rs.close();
               }
            } finally {
View Full Code Here

         {
         }
      }
     
      if (dublicate)
         throw new DuplicateKeyException ("Bean with id="+_id+" already exists.");

      return id;     
   }
View Full Code Here

         {
         }
      }
     
      if (dublicate)
         throw new DuplicateKeyException ("Bean with id="+_id+" already exists.");

      return id;     
   }
View Full Code Here

               ps.setString(1, pk.getKey());

               ResultSet rs = ps.executeQuery();

               if (rs.next())
                  throw new DuplicateKeyException("Bean with accountNumber=" +
                     pk.getKey() +
                     " already exists.");
            }
            finally
            {
View Full Code Here

        log(error);
        throw new CreateException (error);
      }
      String error = "An Account already exists in the database with Primary Key " + accountId;
      log(error);
      throw new DuplicateKeyException(error);
    } finally {
      cleanup(con, ps);
    }
  }
View Full Code Here

        log(error);
        throw new CreateException (error);
      }
      String error = "An Account already exists in the database with Primary Key " + accountId;
      log(error);
      throw new DuplicateKeyException(error);
    } finally {
      cleanup(con, ps);
    }
  }
View Full Code Here

        String msg = I18NHelper.getMessage(cmpMessages,
            "GEN.ejbcreate_exception_dup", beanName, // NOI18N
            findCallingMethodName(), paramList);

        cmpLifecycleLogger.log(Logger.FINER, msg, ex);
        throw new DuplicateKeyException(msg);
    }
View Full Code Here

                rs = ps.executeQuery();
                if (!rs.next()) {
                    throw new CreateException("Error checking if entity with primary pk " + pk + "exists: SQL returned no rows");
                }
                if (rs.getInt(1) > 0) {
                    throw new DuplicateKeyException("Entity with primary key " + pk + " already exists");
                }
            } catch (SQLException e) {
                log.error("Error checking if entity exists", e);
                throw new CreateException("Error checking if entity exists:" + e);
            } finally {
View Full Code Here

TOP

Related Classes of javax.ejb.DuplicateKeyException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.