use of io.jans.orm.exception.operation.EntryNotFoundException in project jans by JanssenProject.
the class SpannerOperationServiceImpl method deleteImpl.
private boolean deleteImpl(TableMapping tableMapping, String key) throws EntryNotFoundException {
try {
List<Mutation> mutations = new ArrayList<>();
mutations.add(Mutation.delete(tableMapping.getTableName(), Key.of(key)));
databaseClient.write(mutations);
return true;
} catch (SpannerException ex) {
throw new EntryNotFoundException("Failed to delete entry", ex);
}
}
use of io.jans.orm.exception.operation.EntryNotFoundException in project jans by JanssenProject.
the class SqlOperationServiceImpl method deleteImpl.
private boolean deleteImpl(TableMapping tableMapping, String key) throws EntryNotFoundException {
try {
RelationalPathBase<Object> tableRelationalPath = buildTableRelationalPath(tableMapping);
SQLDeleteClause sqlDeleteQuery = this.sqlQueryFactory.delete(tableRelationalPath);
Predicate exp = ExpressionUtils.eq(Expressions.stringPath(SqlOperationService.DOC_ID), Expressions.constant(key));
sqlDeleteQuery.where(exp);
long rowDeleted = sqlDeleteQuery.execute();
return rowDeleted == 1;
} catch (QueryException ex) {
throw new EntryNotFoundException("Failed to delete entry", ex);
}
}
use of io.jans.orm.exception.operation.EntryNotFoundException in project jans by JanssenProject.
the class CouchbaseOperationServiceImpl method deleteRecursivelyImpl.
private boolean deleteRecursivelyImpl(BucketMapping bucketMapping, String key) throws SearchException, EntryNotFoundException {
try {
if (enableScopeSupport) {
MutateLimitPath deleteQuery = Delete.deleteFrom(Expression.i(bucketMapping.getBucketName())).where(Expression.path("META().id").like(Expression.s(key + "%")));
N1qlQueryResult result = bucketMapping.getBucket().query(deleteQuery);
if (!result.finalSuccess()) {
throw new SearchException(String.format("Failed to delete entries. Query: '%s'. Error: '%s', Error count: '%d'", deleteQuery, result.errors(), result.info().errorCount()), result.errors().get(0).getInt("code"));
}
} else {
LOG.warn("Removing only base key without sub-tree: " + key);
delete(key);
}
return true;
} catch (CouchbaseException ex) {
throw new EntryNotFoundException("Failed to delete entry", ex);
}
}
Aggregations