Skip to content

Spring CrudRepository dynamic interface projections

Notifications You must be signed in to change notification settings

ITger/dynamicProjections

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is an example project to illustrate how to use dynamic interface projection in spring CrudRepository.

Using dynamic projections we can retrieve an entity of the desired type reducing the size of the query.

This is a very simple yet powerful example.

The magic happens in the following interface:

public interface StudentDynamicRepository extends CrudRepository<Student, Long> {
    <T> T findStudentById(Long id, Class<T> type);
}

Anurag's GitHub stats

Releases

No releases published

Packages

No packages published

Languages