Merge branch 'master' into master

This commit is contained in:
sheryllresulta
2019-05-27 14:54:38 +08:00
committed by GitHub
72 changed files with 781 additions and 1729 deletions
-17
View File
@@ -1,17 +0,0 @@
## Persistence Modules
### Relevant Articles:
- [Introduction to Hibernate Search](http://www.baeldung.com/hibernate-search)
- [Introduction to Lettuce the Java Redis Client](http://www.baeldung.com/java-redis-lettuce)
- [A Guide to Jdbi](http://www.baeldung.com/jdbi)
- [Pessimistic Locking in JPA](http://www.baeldung.com/jpa-pessimistic-locking)
- [Get All Data from a Table with Hibernate](https://www.baeldung.com/hibernate-select-all)
- [Spring Data with Reactive Cassandra](https://www.baeldung.com/spring-data-cassandra-reactive)
- [Spring Data JPA Derived Delete Methods](https://www.baeldung.com/spring-data-jpa-deleteby)
- [Difference Between save() and saveAndFlush() in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-save-saveandflush)
- [Spring Boot with Hibernate](https://www.baeldung.com/spring-boot-hibernate)
- [Persisting Maps with Hibernate](https://www.baeldung.com/hibernate-persisting-maps)
- [Difference Between @Size, @Length, and @Column(length=value)](https://www.baeldung.com/jpa-size-length-column-differences)
@@ -2,3 +2,4 @@
### Relevant Articles:
- [Persisting Maps with Hibernate](https://www.baeldung.com/hibernate-persisting-maps)
- [Difference Between @Size, @Length, and @Column(length=value)](https://www.baeldung.com/jpa-size-length-column-differences)
+2
View File
@@ -1 +1,3 @@
### Relevant Articles:
- [A Guide to Jdbi](http://www.baeldung.com/jdbi)
@@ -15,3 +15,4 @@
- [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs)
- [Tagging and Filtering JUnit Tests](https://www.baeldung.com/junits-filtering-tests)
- [Batch Insert/Update with Hibernate/JPA](https://www.baeldung.com/jpa-hibernate-batch-insert-update)
- [Difference Between save() and saveAndFlush() in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-save-saveandflush)
@@ -43,22 +43,22 @@ public class DeleteFromRepositoryUnitTest {
public void whenDeleteByIdFromRepository_thenDeletingShouldBeSuccessful() {
repository.deleteById(book1.getId());
assertThat(repository.count() == 1).isTrue();
assertThat(repository.count()).isEqualTo(1);
}
@Test
public void whenDeleteAllFromRepository_thenRepositoryShouldBeEmpty() {
repository.deleteAll();
assertThat(repository.count() == 0).isTrue();
assertThat(repository.count()).isEqualTo(0);
}
@Test
@Transactional
public void whenDeleteFromDerivedQuery_thenDeletingShouldBeSuccessful() {
repository.deleteByTitle("The Hobbit");
long deletedRecords = repository.deleteByTitle("The Hobbit");
assertThat(repository.count() == 1).isTrue();
assertThat(deletedRecords).isEqualTo(1);
}
@Test
@@ -66,7 +66,7 @@ public class DeleteFromRepositoryUnitTest {
public void whenDeleteFromCustomQuery_thenDeletingShouldBeSuccessful() {
repository.deleteBooks("The Hobbit");
assertThat(repository.count() == 1).isTrue();
assertThat(repository.count()).isEqualTo(1);
}
}
@@ -46,15 +46,15 @@ public class DeleteInRelationshipsUnitTest {
public void whenDeletingCategories_thenBooksShouldAlsoBeDeleted() {
categoryRepository.deleteAll();
assertThat(bookRepository.count() == 0).isTrue();
assertThat(categoryRepository.count() == 0).isTrue();
assertThat(bookRepository.count()).isEqualTo(0);
assertThat(categoryRepository.count()).isEqualTo(0);
}
@Test
public void whenDeletingBooks_thenCategoriesShouldAlsoBeDeleted() {
bookRepository.deleteAll();
assertThat(bookRepository.count() == 0).isTrue();
assertThat(categoryRepository.count() == 2).isTrue();
assertThat(bookRepository.count()).isEqualTo(0);
assertThat(categoryRepository.count()).isEqualTo(2);
}
}
@@ -3,3 +3,4 @@
- [Hibernate Many to Many Annotation Tutorial](http://www.baeldung.com/hibernate-many-to-many)
- [Programmatic Transactions in the Spring TestContext Framework](http://www.baeldung.com/spring-test-programmatic-transactions)
- [JPA Criteria Queries](http://www.baeldung.com/hibernate-criteria-queries)
- [Introduction to Hibernate Search](http://www.baeldung.com/hibernate-search)