Package javax.ejb

Examples of javax.ejb.ObjectNotFoundException


    public Object execute(Method finderMethod, Object[] args, final CmpEntityBeanContext ctx, final JDBCQueryCommand.EntityProxyFactory factory) throws FinderException {
        JDBCQueryCommand query = manager.getQueryManager().getQueryCommand(finderMethod);
        Collection result = query.execute(finderMethod, args, ctx, factory);
        if (result.isEmpty()) {
            throw new ObjectNotFoundException(NO_SUCH_ENTITY);
        } else if (result.size() == 1) {
            return result.iterator().next();
        } else {
            throw new FinderException("More than one entity matches the finder criteria: " + result);
        }
View Full Code Here


        Object instance;
        boolean cached = entity.getTable().hasRow(pk);
        if (!cached) {
            instance = super.executeFetchOne(args, factory);
            if (instance == null) {
                throw new ObjectNotFoundException("Instance not find: entity=" + entity.getEntityName() + ", pk=" + pk);
            }
        } else {
            instance = pk;
        }
View Full Code Here

                    }
                };
            }
            default: {
                if (result == null) {
                    throw new ObjectNotFoundException("Could not find entity from " + finderMethod + " with params " + Arrays.toString(context.getParameters()));
                }
                return result;
            }
        }
    }
View Full Code Here

                        list.add(resultReader.readRow(rs, factory));
                    }
                    throw new FinderException("More than one instance matches the single-object finder criteria: " + list);
                }
            } else {
                throw new ObjectNotFoundException();
            }
        } catch (FinderException e) {
            throw e;
        } catch (Exception e) {
            FinderException fe = new FinderException(e.getMessage());
View Full Code Here

        }

        if (!Collection.class.isAssignableFrom(getReturnType())) {
            // single object
            if (retVal.size() == 0) {
                throw new ObjectNotFoundException();
            }
            if (retVal.size() > 1) {
                throw new FinderException(getSelectorName() +
                        " returned " + retVal.size() + " objects");
            }
View Full Code Here

      if(!Collection.class.isAssignableFrom(getReturnType()))
      {
         // single object
         if(retVal.size() == 0)
         {
            throw new ObjectNotFoundException();
         }
         if(retVal.size() > 1)
         {
            throw new FinderException(getSelectorName() +
               " returned " + retVal.size() + " objects");
View Full Code Here

      if(!cached)
      {
         instance = super.executeFetchOne(args, factory);
         if(instance == null)
         {
            throw new ObjectNotFoundException("Instance not find: entity=" + entity.getEntityName() + ", pk=" + pk);
         }
      }
      else
      {
         instance = factory.getEntityEJBObject(pk);
View Full Code Here

      JDBCQueryCommand query = manager.getQueryManager().getQueryCommand(finderMethod);

      Collection result = query.execute(finderMethod, args, ctx, factory);
      if(result.isEmpty())
      {
         throw new ObjectNotFoundException(NO_SUCH_ENTITY);
      }
      else if(result.size() == 1)
      {
         return result.iterator().next();
      }
View Full Code Here

               throw new FinderException("More than one instance matches the single-object finder criteria: " + list);
            }
         }
         else
         {
            throw new ObjectNotFoundException();
         }
      }
      catch(FinderException e)
      {
         throw e;
View Full Code Here

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

        try {
            EntityBean bean = (EntityBean) cmpEngine.loadBean(callContext, args[0]);
            if (bean == null) {
                throw new ObjectNotFoundException(beanContext.getDeploymentID() + " : " + args[0]);
            }

            // rebuild the primary key
            KeyGenerator kg = beanContext.getKeyGenerator();
            Object primaryKey = kg.getPrimaryKey(bean);
View Full Code Here

TOP

Related Classes of javax.ejb.ObjectNotFoundException

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.