/** * <p>Delete entity from DB by given ID.</p> * @param pAddParam additional param * @param pId ID * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final Object pId) throws Exception { T entity = retrieveEntityById(pAddParam, pId); deleteEntity(pAddParam, entity); }
/** * <p>Delete entity from DB.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final T pEntity) throws Exception { if (APersistableBase.class.isAssignableFrom(pEntity.getClass()) && !((APersistableBase) pEntity).getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_delete_foreign_src"); } this.srvOrm.deleteEntity(this.entityClass, pEntity.getItsId()); }
.get(pSrvName.replaceFirst("srv", "")); if (entityClass != null) { srvEntity = new SrvEntitySimple(entityClass, lazyGetSrvOrm()); beansMap.put(pSrvName, srvEntity); lazyGetLogger().info(AFactoryAppBeans.class,
/** * <p>Save entity into DB.</p> * @param pAddParam additional param * @param pEntity entity * @param isEntityDetached ignored * @throws Exception - an exception **/ @Override public final void saveEntity(final Map<String, Object> pAddParam, final T pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { this.srvOrm.insertEntity(pEntity); } else { if (APersistableBase.class.isAssignableFrom(pEntity.getClass()) && !((APersistableBase) pEntity).getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_change_foreign_src"); } this.srvOrm.updateEntity(pEntity); } }