Skip to content

Commit 7925d24

Browse files
committed
2 parents 77dec6f + 05c5358 commit 7925d24

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

HibernateSpringBootExampleApi/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
**[How To Check If A Transient Entity Exists In The Database Via Spring Query By Example (QBE)](https://github.com/AnghelLeonard/Hibernate-SpringBoot/tree/master/HibernateSpringBootExampleApi)**
22

3-
**Description:** This application is an example of using Spring Data Query By Example (QBE) to check if a transient entity exists in the database. Consider the `Book` entity and a Spring controller that exposes an endpoint as: `public String checkBook(@Validated @ModelAttribute Book book, ...)`. Beside writting an explicit JPQL, we can rely on Spring Data Query Builder mechanism or, even better, on Query By Example (QBE) API. This is quite useful if the entity has a significant number of attributes and:
3+
**Description:** This application is an example of using Spring Data Query By Example (QBE) to check if a transient entity exists in the database. Consider the `Book` entity and a Spring controller that exposes an endpoint as: `public String checkBook(@Validated @ModelAttribute Book book, ...)`. Beside writting an explicit JPQL, we can rely on Spring Data Query Builder mechanism or, even better, on Query By Example (QBE) API. This API is quite useful if the entity has a significant number of attributes and:
44

5-
- we need a head-to-head comparison of each attribute value to the corresponding column value
6-
- we consider that a `Book` exists if at least one attribute value matches a column value
7-
- we want to compare only a subset of attributes
5+
- for all attributes, we need a head-to-head comparison of each attribute value to the corresponding column value
6+
- for a subset of attributes, we need a head-to-head comparison of each attribute value to the corresponding column value
7+
- for a subset of attributes, we return true at first match between an attribute value and the corresponding column value
8+
- any other scenario
89

910
**Key points:**
1011
- the repository, `BookRepository` extends `QueryByExampleExecutor`

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3237,12 +3237,13 @@ This kind of checks or constraints are easy to implement via database triggers.
32373237
----------------------------------------------------------------------------------------------------------------------
32383238

32393239
229. **[How To Check If A Transient Entity Exists In The Database Via Spring Query By Example (QBE)](https://github.com/AnghelLeonard/Hibernate-SpringBoot/tree/master/HibernateSpringBootExampleApi)**
3240-
3241-
**Description:** This application is an example of using Spring Data Query By Example (QBE) to check if a transient entity exists in the database. Consider the `Book` entity and a Spring controller that exposes an endpoint as: `public String checkBook(@Validated @ModelAttribute Book book, ...)`. Beside writting an explicit JPQL, we can rely on Spring Data Query Builder mechanism or, even better, on Query By Example (QBE) API. This is quite useful if the entity has a significant number of attributes and:
32423240

3243-
- we need a head-to-head comparison of each attribute value to the corresponding column value
3244-
- we consider that a `Book` exists if at least one attribute value matches a column value
3245-
- we want to compare only a subset of attributes
3241+
**Description:** This application is an example of using Spring Data Query By Example (QBE) to check if a transient entity exists in the database. Consider the `Book` entity and a Spring controller that exposes an endpoint as: `public String checkBook(@Validated @ModelAttribute Book book, ...)`. Beside writting an explicit JPQL, we can rely on Spring Data Query Builder mechanism or, even better, on Query By Example (QBE) API. This API is quite useful if the entity has a significant number of attributes and:
3242+
3243+
- for all attributes, we need a head-to-head comparison of each attribute value to the corresponding column value
3244+
- for a subset of attributes, we need a head-to-head comparison of each attribute value to the corresponding column value
3245+
- for a subset of attributes, we return true at first match between an attribute value and the corresponding column value
3246+
- any other scenario
32463247

32473248
**Key points:**
32483249
- the repository, `BookRepository` extends `QueryByExampleExecutor`

0 commit comments

Comments
 (0)