Skip to content

Files

Latest commit

894a6c2 · Dec 17, 2019

History

History

HibernateSpringBootDtoSpringProjectionPropertiesNamedNativeQuery

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Dec 17, 2019
Dec 17, 2019
Dec 17, 2019

How To Use JPA Named Native Queries Via Properties File And Spring Projection (DTO)

Description: This application is an example of combining JPA named native queries listed in a properties file and Spring projections (DTO). For queries names we use the {EntityName}.{RepositoryMethodName} naming convention. This convention allows us to create in the repository interface methods with the same name as of named native query.

Key points:

  • define the named native queries in a properties file (e.g., jpa-named-queries.properties) in a folder named META-INF the application classpath
  • define the proper Spring projection

If you need a deep dive into the performance recipes exposed in this repository then I am sure that you will love my book "Spring Boot Persistence Best Practices"If you need a hand of tips and illustrations of 100+ Java persistence performance issues then "Java Persistence Performance Illustrated Guide" is for you.