Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 1.2 KB

repositories.rst

File metadata and controls

23 lines (17 loc) · 1.2 KB

Repositories

Repositories are used to communicate with the underlying database. We won't need to create a repository for each model <models>. There's a default implementation, that will be used if no appropriate repository was found which provides basic functionality.

The naming of the repository is important, so that Frogr can find it. Names should start with the model <models> name and end with "Repository" (case-sensitive) and it should extend BaseModelRepository or BaseRelationshipRepository.

If, for example, we want a repository for the Person model, we would create a repository called PersonRepository:

../../../examples/basic/src/main/java/de/whitefrog/frogr/example/basic/repository/PersonRepository.java

We can access our repository easily by calling the .repository(..) method of the Service instance. The method takes either the model <models> class or the name as string. There's access to it in any REST service class and inside any repository:

../../../examples/basic/src/main/java/de/whitefrog/frogr/example/basic/rest/Persons.java