Skip to content

Files

Latest commit

 

History

History

HibernateSpringBootDtoSpringProjectionOrmXmlNamedNativeQuery

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

How To Use JPA Named Native Queries Via orm.xml File And Spring Projection (DTO)

Description: This application is an example of combining JPA named native queries listed in orm.xml 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 orm.xml file 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.