Package javax.ejb

Examples of javax.ejb.CreateException


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


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

                try {
View Full Code Here

      } 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

      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

    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

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

            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

         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

    public void ejbCreate() throws CreateException{
        try {
            context = new InitialContext();
            context = (Context) context.lookup("java:comp/env");
        } catch (NamingException e) {
            throw (CreateException)new CreateException().initCause(e);
        }
    }
View Full Code Here

      ctx = new InitialContext();
      String recommenderClassName = (String) ctx.lookup("java:comp/env/recommender-class");
      if (recommenderClassName == null) {
        String recommenderJNDIName = (String) ctx.lookup("java:comp/env/recommender-jndi-name");
        if (recommenderJNDIName == null) {
          throw new CreateException("recommender-class and recommender-jndi-name env-entry not defined");
        }
        recommender = (Recommender) ctx.lookup("java:comp/env/" + recommenderJNDIName);
      } else {
        recommender = Class.forName(recommenderClassName).asSubclass(Recommender.class).newInstance();
      }
     
    } catch (NamingException ne) {
      throw new CreateException(ne.toString());
    } catch (ClassNotFoundException cnfe) {
      throw new CreateException(cnfe.toString());
    } catch (InstantiationException ie) {
      throw new CreateException(ie.toString());
    } catch (IllegalAccessException iae) {
      throw new CreateException(iae.toString());
    } finally {
      if (ctx != null) {
        try {
          ctx.close();
        } catch (NamingException ne) {
          throw new CreateException(ne.toString());
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of javax.ejb.CreateException

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.