All pastes #2466997 Raw Edit

Miscellany

public unlisted java v1 · immutable
#2466997 ·published 2013-10-15 15:53 UTC
rendered paste body
        public boolean deleteBox(Long id){            Boxes box = new Boxes();             box = entityManager.find(Boxes.class, id);             entityManager.remove(box);             if(box==null){                 return true;             }else{                 return false;             }        }public void remove(EntityId id) throws EntityNotFoundException, TransactionRequiredException {  Entity entity = findbyId(id);  try {    entityManager.remove(entity);   }  catch(IllegalArgumentException e) {    log.warn(e.getMessage());    throw new EntityNotFoundException(e);  }  catch(TransactionRequiredException e) {    log.warn(e.getMessage());    throw e;  }}public Entity findbyId(EntityId id)throws EntityNotFoundException {  try {    Entity entity = entityManager.find(Entity.class, id);         if(entity == null && throwNotFoundIfNotExists)      throw new EntityNotFoundException("Entity with id " + id + " could not be found.");    return entity;  }  catch(IllegalArgumentException e) {    log.warn(e.getMessage());    throw new EntityNotFoundException(e);  }}