Java, JPA, Spring, Spring Data

Create and modification date with Spring Data

Using created and last modified fields for an entity is considered general pattern and a good practice. It provides you the information about what and when happens in your database, therefore makes your life easier when the time of problem solving comes. As we love to automatize such boring tasks, using¬†Hibernate it is common to… Continue reading Create and modification date with Spring Data

Cache, Spring Boot, Spring Data

Spring cache and integration testing

Using caches in a Spring application is relatively easy. It makes the overall performance better, but opens some exciting problems when it comes to integration testing the application.¬† Adding caching behavior to a functionality without properly thinking over the consequences, is one of the biggest mistakes, a beginner programmer can make. You must have full… Continue reading Spring cache and integration testing

Spring, Spring Boot, Spring Data

Tipp and tricks using Spring Data

Spring Data is a very comfortable way of defining DAO objects for your project. It can generate a DAO for your entity class, and provide all basic CRUD functions out of the box. You only need to define an interface, inherited from¬†CrudRepository. For more information of Spring Data basics I recommend reading following resources… Continue reading Tipp and tricks using Spring Data

JPA, Spring, Spring Data

Using @ElementCollection in Spring JPA queries

In my domain model, I had a list of Strings to be stored. As it is a typical reason of using element collections, I decided to do so. Using element collection in the domain model has the following advantages: The domain model remains simple. No additional type, The connected list is bounded to the "master"… Continue reading Using @ElementCollection in Spring JPA queries