Examples of CreateException


Examples of br.com.procempa.modus.session.exceptions.CreateException

 
  public Persistent create(Class classe) throws CreateException {
    try {
      this.persistent = (Persistent) classe.newInstance();
    } catch (InstantiationException e) {
      throw new CreateException(e.getMessage());
    } catch (IllegalAccessException e) {
      throw new CreateException(e.getMessage());
    }
    return this.persistent;
  }
View Full Code Here

Examples of ch.grengine.except.CreateException

     */
    public Script create(final Class<?> clazz) throws CreateException {
        try {
            return (Script)clazz.newInstance();
        } catch (Exception e) {
            throw new CreateException("Could not create script for class " + clazz.getCanonicalName() + ".", e);
        }
    }
View Full Code Here

Examples of javax.ejb.CreateException

            oitem.setItem( item );
            getOrderItems(  ).add( oitem );
        }
        catch ( NamingException n )
        {
            throw new CreateException( n.toString(  ) );
        }
    }
View Full Code Here

Examples of javax.ejb.CreateException

                  }
                } catch (Exception ex) {
                  errMsg = errMsg + "Failed to create Individual,";
                  errCounter++;
                  ex.printStackTrace();
                  throw new CreateException();
                } finally {
                  dl.clearParameters();
                }

                try {
View Full Code Here

Examples of javax.ejb.CreateException

      } else {
        dataAccessLayer.setByte(6, sortOrderSequence.byteValue());
      }
      if (dataAccessLayer.executeUpdate() != 1)
      {
        throw new CreateException("Error adding row");
      }
      // get auto_increment id
      this.reportContentId = dataAccessLayer.getAutoGeneratedKey();
      this.fieldId = fieldId;
      this.tableId = tableId;
View Full Code Here

Examples of javax.ejb.CreateException

      dataAccessLayer.setString(8, reportURL);
      dataAccessLayer.setInt(9, reportTypeId);
      dataAccessLayer.setRealDate(10, dateFrom);
      dataAccessLayer.setRealDate(11, dateTo);
      if (dataAccessLayer.executeUpdate() != 1) {
        throw new CreateException("Error adding row");
      }

      // get auto_increment id
      this.reportId = dataAccessLayer.getAutoGeneratedKey();
      this.moduleId = moduleId;
View Full Code Here

Examples of javax.ejb.CreateException

    try {
    dataAccessLayer.setSqlQuery("INSERT INTO reporttype (reporttypename) VALUES (?)");
    dataAccessLayer.setString(1, reportTypeName);

    if (dataAccessLayer.executeUpdate() != 1) {
      throw new CreateException("Error adding row");
    }
    // get auto_increment id
    this.reportTypeId = dataAccessLayer.getAutoGeneratedKey();
    this.reportTypeName = reportTypeName;
    return new ReportTypePK(this.reportTypeId, ds);
View Full Code Here

Examples of javax.ejb.CreateException

        
         return id;
      }
      catch (IllegalAccessException e)
      {
         throw new CreateException("Could not create entity: "+e);
      }
   }
View Full Code Here

Examples of javax.ejb.CreateException

            ps = con.prepareStatement(pkSql);
            rs = ps.executeQuery();

            if(!rs.next())
            {
               throw new CreateException("pk-sql " + pkSql + " returned no results!");
            }

            pk = pkField.loadArgumentResults(rs, 1);
            pctx.setFieldValue(pkField.getRowIndex(), pk);
            pk = entityBridge.extractPrimaryKeyFromInstance(ctx);
         }
         catch(SQLException e)
         {
            log.error("Failed to execute pk sql. error code: " + e.getErrorCode() + ", sql state: " + e.getSQLState(), e);
            throw new CreateException("Failed to execute pk sql: " + e.getMessage() +
               ", error code: " + e.getErrorCode() + ", sql state: " + e.getSQLState());
         }
         finally
         {
            JDBCUtil.safeClose(rs);
            JDBCUtil.safeClose(ps);
            JDBCUtil.safeClose(con);
         }

         if(pk == null)
         {
            log.error("Primary key for created instance is null.");
            throw new CreateException("Primary key for created instance is null.");
         }

         pctx.setPk(pk);
      }
      else
      {
         // insert-after-ejb-post-create
         try
         {
            pctx.flush();
         }
         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() +
                  ", state=" +
                  e.getSQLState() +
                  ", msg=" + e.getMessage());
            }
View Full Code Here

Examples of javax.ejb.CreateException

         log.info(msg);
      }
      catch(Exception e)
      {
         log.error("Failed to create EntityPK", e);
         throw new CreateException("Failed to create EntityPK: "+e.getMessage());
      }
      return msg;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.