From 9840680d734abe6188d2197e1fb6f538d64a2020 Mon Sep 17 00:00:00 2001
From: Otavio Santana
Date: Thu, 5 Oct 2023 16:26:13 +0100
Subject: [PATCH 01/11] feat: return the CrudRepository
Signed-off-by: Otavio Santana
---
.../data/repository/BasicRepository.java | 64 -----------
.../data/repository/CrudRepository.java | 102 ++++++++++++++++++
2 files changed, 102 insertions(+), 64 deletions(-)
create mode 100644 api/src/main/java/jakarta/data/repository/CrudRepository.java
diff --git a/api/src/main/java/jakarta/data/repository/BasicRepository.java b/api/src/main/java/jakarta/data/repository/BasicRepository.java
index 7e50269be..e6c3263b1 100644
--- a/api/src/main/java/jakarta/data/repository/BasicRepository.java
+++ b/api/src/main/java/jakarta/data/repository/BasicRepository.java
@@ -84,70 +84,6 @@ public interface BasicRepository extends DataRepository {
*/
Iterable saveAll(Iterable entities);
- /**
- * Inserts an entity into the database. If an entity of this type with the same
- * unique identifier already exists in the database, then this method raises
- * {@link EntityExistsException}.
- *
- * @param entity the entity to insert. Must not be {@code null}.
- * @throws EntityExistsException if the entity is already present in the database.
- * @throws NullPointerException if the entity is null.
- * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
- * that use an append model to write data.
- */
- void insert(T entity);
-
- /**
- * Inserts multiple entities into the database. If an entity of this type with the same
- * unique identifier as any of the given entities already exists in the database,
- * then this method raises {@link EntityExistsException}.
- *
- * @param entities entities to insert.
- * @throws EntityExistsException if any of the entities are already present in the database.
- * @throws NullPointerException if either the iterable is null or any element is null.
- * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
- * that use an append model to write data.
- */
- void insertAll(Iterable entities);
-
- /**
- * Modifies an entity that already exists in the database.
- *
- * For an update to be made, a matching entity with the same unique identifier
- * must be present in the database.
- *
- * If the entity is versioned (for example, with {@code jakarta.persistence.Version} or by
- * another convention from the entity model such as having an attribute named {@code version}),
- * then the version must also match. The version is automatically incremented when making
- * the update.
- *
- * Non-matching entities are ignored and do not cause an error to be raised.
- *
- * @param entity the entity to update.
- * @return true if a matching entity was found in the database to update, otherwise false.
- * @throws NullPointerException if the entity is null.
- */
- boolean update(T entity);
-
- /**
- * Modifies entities that already exists in the database.
- *
- * For an update to be made to an entity, a matching entity with the same unique identifier
- * must be present in the database.
- *
- * If the entity is versioned (for example, with {@code jakarta.persistence.Version} or by
- * another convention from the entity model such as having an attribute named {@code version}),
- * then the version must also match. The version is automatically incremented when making
- * the update.
- *
- * Non-matching entities are ignored and do not cause an error to be raised.
- *
- * @param entities entities to update.
- * @return the number of matching entities that were found in the database to update.
- * @throws NullPointerException if either the iterable is null or any element is null.
- */
- int updateAll(Iterable entities);
-
/**
* Retrieves an entity by its id.
*
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
new file mode 100644
index 000000000..d98421bcc
--- /dev/null
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2022,2023 Contributors to the Eclipse Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+package jakarta.data.repository;
+
+import jakarta.data.exceptions.EntityExistsException;
+
+/**
+ * A repository interface that extends the capabilities of basic operations on entities, including insert and update operations.
+ *
+ * This repository extends the {@link BasicRepository} interface, providing a comprehensive set of methods to interact with
+ * persistent entities of type {@code }, where {@code } represents the entity bean type, and {@code } represents the key type.
+ *
+ * It encompasses standard CRUD (Create, Read, Update, Delete) operations, allowing you to perform insert and update operations in
+ * addition to basic retrieval and deletion. This interface combines the Data Access Object (DAO) aspect with the repository pattern,
+ * offering a versatile and complete solution for managing persistent entities within your Java applications.
+ *
+ * @param the entity bean type
+ * @param the key type.
+ * @see BasicRepository
+ * @see DataRepository
+ */
+public interface CrudRepository extends BasicRepository {
+
+ /**
+ * Inserts an entity into the database. If an entity of this type with the same
+ * unique identifier already exists in the database, then this method raises
+ * {@link EntityExistsException}.
+ *
+ * @param entity the entity to insert. Must not be {@code null}.
+ * @throws EntityExistsException if the entity is already present in the database.
+ * @throws NullPointerException if the entity is null.
+ * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
+ * that use an append model to write data.
+ */
+ void insert(T entity);
+
+ /**
+ * Inserts multiple entities into the database. If an entity of this type with the same
+ * unique identifier as any of the given entities already exists in the database,
+ * then this method raises {@link EntityExistsException}.
+ *
+ * @param entities entities to insert.
+ * @throws EntityExistsException if any of the entities are already present in the database.
+ * @throws NullPointerException if either the iterable is null or any element is null.
+ * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
+ * that use an append model to write data.
+ */
+ void insertAll(Iterable entities);
+
+ /**
+ * Modifies an entity that already exists in the database.
+ *
+ * For an update to be made, a matching entity with the same unique identifier
+ * must be present in the database.
+ *
+ * If the entity is versioned (for example, with {@code jakarta.persistence.Version} or by
+ * another convention from the entity model such as having an attribute named {@code version}),
+ * then the version must also match. The version is automatically incremented when making
+ * the update.
+ *
+ * Non-matching entities are ignored and do not cause an error to be raised.
+ *
+ * @param entity the entity to update.
+ * @return true if a matching entity was found in the database to update, otherwise false.
+ * @throws NullPointerException if the entity is null.
+ */
+ boolean update(T entity);
+
+ /**
+ * Modifies entities that already exists in the database.
+ *
+ * For an update to be made to an entity, a matching entity with the same unique identifier
+ * must be present in the database.
+ *
+ * If the entity is versioned (for example, with {@code jakarta.persistence.Version} or by
+ * another convention from the entity model such as having an attribute named {@code version}),
+ * then the version must also match. The version is automatically incremented when making
+ * the update.
+ *
+ * Non-matching entities are ignored and do not cause an error to be raised.
+ *
+ * @param entities entities to update.
+ * @return the number of matching entities that were found in the database to update.
+ * @throws NullPointerException if either the iterable is null or any element is null.
+ */
+ int updateAll(Iterable entities);
+}
From 18599e27400fc7d5e8c4807ec0242bc05905e0c7 Mon Sep 17 00:00:00 2001
From: Otavio Santana
Date: Thu, 5 Oct 2023 16:28:37 +0100
Subject: [PATCH 02/11] feat: create CrudRepository
Signed-off-by: Otavio Santana
---
.../main/java/jakarta/data/repository/CrudRepository.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index d98421bcc..2684d0387 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -47,7 +47,7 @@ public interface CrudRepository extends BasicRepository {
* @throws UnsupportedOperationException for Key-Value and Wide-Column databases
* that use an append model to write data.
*/
- void insert(T entity);
+ T insert(T entity);
/**
* Inserts multiple entities into the database. If an entity of this type with the same
@@ -60,7 +60,7 @@ public interface CrudRepository extends BasicRepository {
* @throws UnsupportedOperationException for Key-Value and Wide-Column databases
* that use an append model to write data.
*/
- void insertAll(Iterable entities);
+ Iterable insertAll(Iterable entities);
/**
* Modifies an entity that already exists in the database.
@@ -79,7 +79,7 @@ public interface CrudRepository extends BasicRepository {
* @return true if a matching entity was found in the database to update, otherwise false.
* @throws NullPointerException if the entity is null.
*/
- boolean update(T entity);
+ Iterable update(T entity);
/**
* Modifies entities that already exists in the database.
@@ -98,5 +98,5 @@ public interface CrudRepository extends BasicRepository {
* @return the number of matching entities that were found in the database to update.
* @throws NullPointerException if either the iterable is null or any element is null.
*/
- int updateAll(Iterable entities);
+ Iterable updateAll(Iterable entities);
}
From 264db0d90dcca6819f42c291b68d73062b7ccbb5 Mon Sep 17 00:00:00 2001
From: Otavio Santana
Date: Thu, 5 Oct 2023 16:36:17 +0100
Subject: [PATCH 03/11] feat:change documentation to update
Signed-off-by: Otavio Santana
---
.../java/jakarta/data/repository/CrudRepository.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index 2684d0387..7fc70382e 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -39,13 +39,13 @@ public interface CrudRepository extends BasicRepository {
/**
* Inserts an entity into the database. If an entity of this type with the same
* unique identifier already exists in the database, then this method raises
- * {@link EntityExistsException}.
+ * {@link EntityExistsException} for.
*
* @param entity the entity to insert. Must not be {@code null}.
+ * @return the inserted entity.
* @throws EntityExistsException if the entity is already present in the database.
* @throws NullPointerException if the entity is null.
- * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
- * that use an append model to write data.
+ * @throws UnsupportedOperationException for databases that use an append model to write data.
*/
T insert(T entity);
@@ -55,6 +55,7 @@ public interface CrudRepository extends BasicRepository {
* then this method raises {@link EntityExistsException}.
*
* @param entities entities to insert.
+ * @return an iterable containing the inserted entities.
* @throws EntityExistsException if any of the entities are already present in the database.
* @throws NullPointerException if either the iterable is null or any element is null.
* @throws UnsupportedOperationException for Key-Value and Wide-Column databases
@@ -76,7 +77,7 @@ public interface CrudRepository extends BasicRepository {
* Non-matching entities are ignored and do not cause an error to be raised.
*
* @param entity the entity to update.
- * @return true if a matching entity was found in the database to update, otherwise false.
+ * @return the updated entity.
* @throws NullPointerException if the entity is null.
*/
Iterable update(T entity);
@@ -95,7 +96,7 @@ public interface CrudRepository extends BasicRepository {
* Non-matching entities are ignored and do not cause an error to be raised.
*
* @param entities entities to update.
- * @return the number of matching entities that were found in the database to update.
+ * @return the updated entities.
* @throws NullPointerException if either the iterable is null or any element is null.
*/
Iterable updateAll(Iterable entities);
From 1b89b79931fc9b1b4f0350f6367ae6da5e322a78 Mon Sep 17 00:00:00 2001
From: Otavio Santana
Date: Thu, 5 Oct 2023 16:44:17 +0100
Subject: [PATCH 04/11] style: remove unsed import
Signed-off-by: Otavio Santana
---
api/src/main/java/jakarta/data/repository/BasicRepository.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/api/src/main/java/jakarta/data/repository/BasicRepository.java b/api/src/main/java/jakarta/data/repository/BasicRepository.java
index e6c3263b1..035887a4c 100644
--- a/api/src/main/java/jakarta/data/repository/BasicRepository.java
+++ b/api/src/main/java/jakarta/data/repository/BasicRepository.java
@@ -17,7 +17,6 @@
*/
package jakarta.data.repository;
-import jakarta.data.exceptions.EntityExistsException;
import jakarta.data.exceptions.OptimisticLockingFailureException;
import java.util.Optional;
import java.util.stream.Stream;
From 62cc8d34e58bd51bf2e149831b6fa37713cf10b5 Mon Sep 17 00:00:00 2001
From: Otavio Santana
Date: Thu, 5 Oct 2023 17:04:37 +0100
Subject: [PATCH 05/11] docs: update documentation at CrudRepository
Signed-off-by: Otavio Santana
---
api/src/main/java/jakarta/data/repository/CrudRepository.java | 3 ---
1 file changed, 3 deletions(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index 7fc70382e..85ea5a1d7 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -45,7 +45,6 @@ public interface CrudRepository extends BasicRepository {
* @return the inserted entity.
* @throws EntityExistsException if the entity is already present in the database.
* @throws NullPointerException if the entity is null.
- * @throws UnsupportedOperationException for databases that use an append model to write data.
*/
T insert(T entity);
@@ -58,8 +57,6 @@ public interface CrudRepository extends BasicRepository {
* @return an iterable containing the inserted entities.
* @throws EntityExistsException if any of the entities are already present in the database.
* @throws NullPointerException if either the iterable is null or any element is null.
- * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
- * that use an append model to write data.
*/
Iterable insertAll(Iterable entities);
From e52fbce00e631ac1b05fb7099812f24061bcf8b5 Mon Sep 17 00:00:00 2001
From: Otavio Santana
Date: Thu, 5 Oct 2023 17:10:18 +0100
Subject: [PATCH 06/11] docs: pdate the insert docs
Signed-off-by: Otavio Santana
---
.../jakarta/data/repository/CrudRepository.java | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index 85ea5a1d7..7fb5e7869 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -38,12 +38,14 @@ public interface CrudRepository extends BasicRepository {
/**
* Inserts an entity into the database. If an entity of this type with the same
- * unique identifier already exists in the database, then this method raises
- * {@link EntityExistsException} for.
+ * unique identifier already exists in the database, then this method may raise
+ * {@link EntityExistsException} for relational databases; however, the behavior
+ * in NoSQL databases may vary depending on the provider, especially in cases where
+ * the provider supports does not implement ACID or doesn't work with an append model.
*
* @param entity the entity to insert. Must not be {@code null}.
* @return the inserted entity.
- * @throws EntityExistsException if the entity is already present in the database.
+ * @throws EntityExistsException if the entity is already present in the database (relational databases).
* @throws NullPointerException if the entity is null.
*/
T insert(T entity);
@@ -51,11 +53,15 @@ public interface CrudRepository extends BasicRepository {
/**
* Inserts multiple entities into the database. If an entity of this type with the same
* unique identifier as any of the given entities already exists in the database,
- * then this method raises {@link EntityExistsException}.
+ * then this method raises {@link EntityExistsException} for relational databases;
+ * however, the behavior in NoSQL databases may vary depending on the provider,
+ * especially in cases where the provider supports ACID transactions or doesn't work
+ * with an append model.
*
* @param entities entities to insert.
* @return an iterable containing the inserted entities.
- * @throws EntityExistsException if any of the entities are already present in the database.
+ * @throws EntityExistsException if any of the entities are already present in the
+ * database (relational databases).
* @throws NullPointerException if either the iterable is null or any element is null.
*/
Iterable insertAll(Iterable entities);
From 56b7c42ad818f16e2608de1e37c747f62be6edf1 Mon Sep 17 00:00:00 2001
From: Otavio Santana
Date: Thu, 5 Oct 2023 17:13:58 +0100
Subject: [PATCH 07/11] docs: update documentation to Crud
Signed-off-by: Otavio Santana
---
.../java/jakarta/data/repository/CrudRepository.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index 7fb5e7869..a4079feae 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -67,9 +67,8 @@ public interface CrudRepository extends BasicRepository {
Iterable insertAll(Iterable entities);
/**
- * Modifies an entity that already exists in the database.
- *
- * For an update to be made, a matching entity with the same unique identifier
+ *
Modifies an entity that already exists in the database. In relational databases,
+ * for an update to be made, a matching entity with the same unique identifier
* must be present in the database.
*
* If the entity is versioned (for example, with {@code jakarta.persistence.Version} or by
@@ -77,6 +76,8 @@ public interface CrudRepository extends BasicRepository {
* then the version must also match. The version is automatically incremented when making
* the update.
*
+ * In some NoSQL databases, this method might work as an alias to insert, mainly, if the database work in an append model
+ *
* Non-matching entities are ignored and do not cause an error to be raised.
*
* @param entity the entity to update.
@@ -96,6 +97,8 @@ public interface CrudRepository extends BasicRepository {
* then the version must also match. The version is automatically incremented when making
* the update.
*
+ * In some NoSQL databases, this method might work as an alias to insert, mainly, if the database work in an append model
+ *
* Non-matching entities are ignored and do not cause an error to be raised.
*
* @param entities entities to update.
From 4be284152c30147cefda146dfa61a5b7c9a0d81e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ot=C3=A1vio=20Santana?=
Date: Fri, 6 Oct 2023 05:36:33 +0100
Subject: [PATCH 08/11] Update
api/src/main/java/jakarta/data/repository/CrudRepository.java
Co-authored-by: Nathan Rauh
---
api/src/main/java/jakarta/data/repository/CrudRepository.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index a4079feae..a024c22d0 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -102,8 +102,8 @@ public interface CrudRepository extends BasicRepository {
* Non-matching entities are ignored and do not cause an error to be raised.
*
* @param entities entities to update.
- * @return the updated entities.
+ * @return the number of matching entities that were found in the database to update.
* @throws NullPointerException if either the iterable is null or any element is null.
*/
- Iterable updateAll(Iterable entities);
+ int updateAll(Iterable entities);
}
From 43155f998e5054e7cc5d716955e92af38a437ec2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ot=C3=A1vio=20Santana?=
Date: Fri, 6 Oct 2023 05:37:29 +0100
Subject: [PATCH 09/11] Update
api/src/main/java/jakarta/data/repository/CrudRepository.java
Co-authored-by: Nathan Rauh
---
.../main/java/jakarta/data/repository/CrudRepository.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index a024c22d0..719adc341 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -81,10 +81,11 @@ public interface CrudRepository extends BasicRepository {
* Non-matching entities are ignored and do not cause an error to be raised.
*
* @param entity the entity to update.
- * @return the updated entity.
+ * @param entity the entity to update.
+ * @return true if a matching entity was found in the database to update, otherwise false.
* @throws NullPointerException if the entity is null.
*/
- Iterable update(T entity);
+ boolean update(T entity);
/**
* Modifies entities that already exists in the database.
From f5000873584886161689405f9265d3663c6e382a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ot=C3=A1vio=20Santana?=
Date: Fri, 6 Oct 2023 05:37:35 +0100
Subject: [PATCH 10/11] Update
api/src/main/java/jakarta/data/repository/CrudRepository.java
Co-authored-by: Nathan Rauh
---
api/src/main/java/jakarta/data/repository/CrudRepository.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index 719adc341..f7ed2334f 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -88,7 +88,7 @@ public interface CrudRepository extends BasicRepository {
boolean update(T entity);
/**
- * Modifies entities that already exists in the database.
+ * Modifies entities that already exist in the database.
*
* For an update to be made to an entity, a matching entity with the same unique identifier
* must be present in the database.
From 2f5dda1ecac1cf0fdf8563d54a9284c2d79b0544 Mon Sep 17 00:00:00 2001
From: Otavio Santana
Date: Fri, 6 Oct 2023 05:44:27 +0100
Subject: [PATCH 11/11] feat: return the CrudRepository methods originally from
the BasicRepository
Signed-off-by: Otavio Santana
---
.../data/repository/CrudRepository.java | 38 ++++++++-----------
1 file changed, 15 insertions(+), 23 deletions(-)
diff --git a/api/src/main/java/jakarta/data/repository/CrudRepository.java b/api/src/main/java/jakarta/data/repository/CrudRepository.java
index f7ed2334f..d98421bcc 100644
--- a/api/src/main/java/jakarta/data/repository/CrudRepository.java
+++ b/api/src/main/java/jakarta/data/repository/CrudRepository.java
@@ -38,37 +38,34 @@ public interface CrudRepository extends BasicRepository {
/**
* Inserts an entity into the database. If an entity of this type with the same
- * unique identifier already exists in the database, then this method may raise
- * {@link EntityExistsException} for relational databases; however, the behavior
- * in NoSQL databases may vary depending on the provider, especially in cases where
- * the provider supports does not implement ACID or doesn't work with an append model.
+ * unique identifier already exists in the database, then this method raises
+ * {@link EntityExistsException}.
*
* @param entity the entity to insert. Must not be {@code null}.
- * @return the inserted entity.
- * @throws EntityExistsException if the entity is already present in the database (relational databases).
+ * @throws EntityExistsException if the entity is already present in the database.
* @throws NullPointerException if the entity is null.
+ * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
+ * that use an append model to write data.
*/
- T insert(T entity);
+ void insert(T entity);
/**
* Inserts multiple entities into the database. If an entity of this type with the same
* unique identifier as any of the given entities already exists in the database,
- * then this method raises {@link EntityExistsException} for relational databases;
- * however, the behavior in NoSQL databases may vary depending on the provider,
- * especially in cases where the provider supports ACID transactions or doesn't work
- * with an append model.
+ * then this method raises {@link EntityExistsException}.
*
* @param entities entities to insert.
- * @return an iterable containing the inserted entities.
- * @throws EntityExistsException if any of the entities are already present in the
- * database (relational databases).
+ * @throws EntityExistsException if any of the entities are already present in the database.
* @throws NullPointerException if either the iterable is null or any element is null.
+ * @throws UnsupportedOperationException for Key-Value and Wide-Column databases
+ * that use an append model to write data.
*/
- Iterable insertAll(Iterable entities);
+ void insertAll(Iterable entities);
/**
- * Modifies an entity that already exists in the database. In relational databases,
- * for an update to be made, a matching entity with the same unique identifier
+ *
Modifies an entity that already exists in the database.
+ *
+ * For an update to be made, a matching entity with the same unique identifier
* must be present in the database.
*
* If the entity is versioned (for example, with {@code jakarta.persistence.Version} or by
@@ -76,19 +73,16 @@ public interface CrudRepository extends BasicRepository {
* then the version must also match. The version is automatically incremented when making
* the update.
*
- * In some NoSQL databases, this method might work as an alias to insert, mainly, if the database work in an append model
- *
* Non-matching entities are ignored and do not cause an error to be raised.
*
* @param entity the entity to update.
- * @param entity the entity to update.
* @return true if a matching entity was found in the database to update, otherwise false.
* @throws NullPointerException if the entity is null.
*/
boolean update(T entity);
/**
- * Modifies entities that already exist in the database.
+ * Modifies entities that already exists in the database.
*
* For an update to be made to an entity, a matching entity with the same unique identifier
* must be present in the database.
@@ -98,8 +92,6 @@ public interface CrudRepository extends BasicRepository {
* then the version must also match. The version is automatically incremented when making
* the update.
*
- * In some NoSQL databases, this method might work as an alias to insert, mainly, if the database work in an append model
- *
* Non-matching entities are ignored and do not cause an error to be raised.
*
* @param entities entities to update.