diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index b7937f77e..50d001f48 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -8,6 +8,14 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version == [Unreleased] +=== Added + +* Add Delete by entity at Template + +=== Changed + +* Change the KeyValueTemplate method to use deleteByKey + == [1.0.0-b7] - 2023-06-22 === Added diff --git a/api/nosql-core/src/main/java/jakarta/nosql/Template.java b/api/nosql-core/src/main/java/jakarta/nosql/Template.java index bf541e6f3..85a4a1fb8 100644 --- a/api/nosql-core/src/main/java/jakarta/nosql/Template.java +++ b/api/nosql-core/src/main/java/jakarta/nosql/Template.java @@ -190,6 +190,22 @@ public interface Template { */ void delete(Class type, K id); + /** + * Deletes a given entity. Deletion is performed by matching the Id. + * + * @param entity must not be {@literal null}. + * @throws NullPointerException when the entity is null + */ + void delete(T entity); + + /** + * Deletes the given entities. Deletion of each entity is performed by matching the Id. + * + * @param entities must not be {@literal null}. Must not contain {@literal null} elements. + * @throws NullPointerException when either the iterable is null or contains null elements + */ + void delete(Iterable entities); + /** * It starts a query using the fluent-API journey. It is a mutable and non-thread-safe instance. * diff --git a/api/nosql-key-value/src/main/java/jakarta/nosql/keyvalue/KeyValueTemplate.java b/api/nosql-key-value/src/main/java/jakarta/nosql/keyvalue/KeyValueTemplate.java index 290288700..5a55b3307 100644 --- a/api/nosql-key-value/src/main/java/jakarta/nosql/keyvalue/KeyValueTemplate.java +++ b/api/nosql-key-value/src/main/java/jakarta/nosql/keyvalue/KeyValueTemplate.java @@ -183,7 +183,7 @@ default Iterable put(Iterable entities, Duration ttl) { * @param the key type * @throws NullPointerException when the key is null */ - void delete(K key); + void deleteByKey(K key); /** * Removes entities from keys @@ -192,6 +192,6 @@ default Iterable put(Iterable entities, Duration ttl) { * @param the key type * @throws NullPointerException when the key is null */ - void delete(Iterable keys); + void deleteByKey(Iterable keys); }