Repository Concept

How to quickly create JPA Queries for nested properties

March 25, 2024
Spring, Spring Data JPA
JPA Queries, Repository Concept, Normalisation

Sometimes we may need to define some of entity’s fields and properties as embedded classes or records. As the information is still persisted at the entity level, there may be a need to query data using this embedded information. So how to quickly define a corresponding query method in a Spring Data JPA Repository? Example # Let’s take the following example: public class SomeEntity { private String someField; @Embedded private SomeValueObject someEmbeddedField; . ...