Data Repository Wizard

Studio provides a wizard for creating and managing data repositories.

To create a repository, click New → Data Repository in Jmix tool window toolbar.

data repository create

In the New Jmix Data Repository dialog, select an entity and click OK. Studio will create the repository interface extending JmixDataRepository and add @EnableJmixDataRepositories to the main application class.

data repository wizard

When a data repository is opened in the editor, Studio shows the actions panel on top with two buttons. The Add Derived Method button allows you to create a method whose query will be derived from the method name. The Add Query Method creates a method with explicitly specified JPQL query.

data repository methods

Both methods open special dialogs where you can define the query and its parameters.

find method create

For all existing methods of a repository, Studio displays a "gear" gutter icon. It allows you to adjust the method parameters, for example add sorting or fetch plan. You can also extract the query into the @Query annotation and change the method name as you like.

data repository methods gear

Data repositories created for a particular entity are displayed in Jmix tool window in the Data Repositories section inside the entity section.

data repository tool window