Examples of EntityBean


Examples of com.avaje.ebean.bean.EntityBean

  private void diffEmbedded(String prefix, EntityBean a, EntityBean b, BeanDescriptor<?> desc, Map<String, ValuePair> map) {

    BeanPropertyAssocOne<?>[] emb = desc.propertiesEmbedded();

    for (int i = 0; i < emb.length; i++) {
      EntityBean aval = (EntityBean)emb[i].getValue(a);
      EntityBean bval = (EntityBean)emb[i].getValue(b);
     
      if (!isBothNull(aval, bval)) {
        String propName = (prefix == null) ? emb[i].getName() : prefix + emb[i].getName();
        if (isDiffNull(aval, bval)) {
          // one of the embedded beans is null
View Full Code Here

Examples of com.avaje.ebean.bean.EntityBean

    }
  }

  private void deleteList(List<?> beanList, Transaction t) {
    for (int i = 0; i < beanList.size(); i++) {
      EntityBean bean = (EntityBean)beanList.get(i);
      delete(bean, t);
    }
  }
View Full Code Here

Examples of com.avaje.ebean.bean.EntityBean

        } else {
          q.where().idEq(id);
          if (t.isLogSummary()) {
            t.logSummary("-- DeleteById of " + descriptor.getName() + " id[" + id + "] requires fetch of foreign key values");
          }
          EntityBean bean = (EntityBean)server.findUnique(q, t);
          if (bean == null) {
            return 0;
          } else {
            delete(bean, t);
            return 1;
View Full Code Here

Examples of com.avaje.ebean.bean.EntityBean

   * bean to the child beans.
   * </p>
   */
  private void saveAssocMany(boolean insertedParent, PersistRequestBean<?> request, boolean insertMode) {

    EntityBean parentBean = request.getEntityBean();
    BeanDescriptor<?> desc = request.getBeanDescriptor();
    SpiTransaction t = request.getTransaction();

    // exported ones with cascade save
    BeanPropertyAssocOne<?>[] expOnes = desc.propertiesOneExportedSave();
    for (int i = 0; i < expOnes.length; i++) {
      BeanPropertyAssocOne<?> prop = expOnes[i];

      // check for partial beans
      if (request.isLoadedProperty(prop)) {
        EntityBean detailBean = prop.getValueAsEntityBean(parentBean);
        if (detailBean != null) {
          if (prop.isSaveRecurseSkippable(detailBean)) {
            // skip saving this bean
          } else {
            t.depth(+1);
View Full Code Here

Examples of com.avaje.ebean.bean.EntityBean

        SpiTransaction t = saveMany.getTransaction();
        // increase depth for batching order
        t.depth(+1);
        for (Object removedBean : modifyRemovals) {
          if (removedBean instanceof EntityBean) {
            EntityBean eb = (EntityBean)removedBean;
            if (eb._ebean_getIntercept().isLoaded()) {
              // only delete if the bean was loaded meaning that
              // it is know to exist in the DB
              deleteRecurse(removedBean, t);
            }
          }
View Full Code Here

Examples of com.avaje.ebean.bean.EntityBean

    // if a map, then we get the key value and
    // set it to the appropriate property on the
    // detail bean before we save it
    boolean isMap = ManyType.JAVA_MAP.equals(prop.getManyType());
    EntityBean parentBean = (EntityBean)saveMany.getParentBean();
    Object mapKeyValue = null;

    boolean saveSkippable = prop.isSaveRecurseSkippable();
    boolean skipSavingThisBean = false;

    for (Object detailBean : collection) {
      if (isMap) {
        // its a map so need the key and value
        Map.Entry<?, ?> entry = (Map.Entry<?, ?>) detailBean;
        mapKeyValue = entry.getKey();
        detailBean = entry.getValue();
      }

      if (detailBean instanceof EntityBean == false) {
        skipSavingThisBean = true;
        logger.debug("Skip non entity bean");
     
      } else {
        EntityBean detail = (EntityBean)detailBean;
        EntityBeanIntercept ebi = detail._ebean_getIntercept();
        if (prop.isManyToMany()) {
          skipSavingThisBean = targetDescriptor.isReference(ebi);
        } else {
          if (targetDescriptor.isReference(ebi)) {
            // we can skip this one
View Full Code Here

Examples of com.avaje.ebean.bean.EntityBean

      BeanPropertyAssocMany<?> manyProp = (BeanPropertyAssocMany<?>) prop;
      saveMany(new SaveManyPropRequest(manyProp, parentBean, (SpiTransaction) t), true);

    } else if (prop instanceof BeanPropertyAssocOne<?>) {
      BeanPropertyAssocOne<?> oneProp = (BeanPropertyAssocOne<?>) prop;
      EntityBean assocBean = oneProp.getValueAsEntityBean(parentBean);

      int depth = oneProp.isOneToOneExported() ? 1 : -1;
      int revertDepth = -1 * depth;

      trans.depth(depth);
 
View Full Code Here

Examples of com.avaje.ebean.bean.EntityBean

    t.depth(+1);

    if (additions != null && !additions.isEmpty()) {
      for (Object other : additions) {
        EntityBean otherBean = (EntityBean)other;
        // the object from the 'other' side of the ManyToMany
        if (deletions != null && deletions.remove(otherBean)) {
          String m = "Inserting and Deleting same object? " + otherBean;
          if (t.isLogSummary()) {
            t.logSummary(m);
          }
          logger.warn(m);

        } else {
          if (!prop.hasImportedId(otherBean)) {
            String msg = "ManyToMany bean " + otherBean + " does not have an Id value.";
            throw new PersistenceException(msg);

          } else {
            // build a intersection row for 'insert'
            IntersectionRow intRow = prop.buildManyToManyMapBean(saveManyPropRequest.getParentBean(), otherBean);
            SqlUpdate sqlInsert = intRow.createInsert(server);
            executeSqlUpdate(sqlInsert, t);
          }
        }
      }
    }
    if (deletions != null && !deletions.isEmpty()) {
      for (Object other : deletions) {
        EntityBean otherDelete = (EntityBean)other;
        // the object from the 'other' side of the ManyToMany
        // build a intersection row for 'delete'
        IntersectionRow intRow = prop.buildManyToManyMapBean(saveManyPropRequest.getParentBean(), otherDelete);
        SqlUpdate sqlDelete = intRow.createDelete(server);
        executeSqlUpdate(sqlDelete, t);
View Full Code Here

Examples of javax.ejb.EntityBean

    protected Object invoke(Method callMethod, Method runMethod, Object [] args, ThreadContext callContext) throws OpenEJBException {
        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);

        EntityBean bean = null;

        Object returnValue = null;
        entrancyTracker.enter(callContext.getDeploymentInfo(), callContext.getPrimaryKey());
        try {
            bean = instanceManager.obtainInstance(callContext);
View Full Code Here

Examples of javax.ejb.EntityBean

        * super classes afterInvoke( ) method will be executed committing the transaction if its a CMT.
        */

        TransactionPolicy txPolicy = createTransactionPolicy(deploymentInfo.getTransactionType(callMethod), callContext);

        EntityBean bean = null;
        Object primaryKey = null;
        try {
            // Get new ready instance
            bean = instanceManager.obtainInstance(callContext);

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.