IntelliJ IDEA 2026.2 Help

JPA Console

The JPA Console lets you write, validate, and run queries in the following languages:

Prerequisites

Open the console

Open the JPA Console manually if you want to run JPQL, HQL, or EQL queries that are not present in your code or if you want the console to use custom JVM options.

Open the console with default settings

  1. Open the Persistence tool window (View | Tool Windows | Persistence).

  2. Select a persistence unit.

  3. In the tool window toolbar, click Console icon JPA Console.

    Location of the JPA Console icon in the Persistence tool window
    • Alternatively, press Ctrl+Shift+F10.

The JPA Console opens in a dedicated tool window. You can now run queries.

JPA Console tool window

To learn what the icons in the console represent, refer to Reference: JPA Console.

Open the console with custom JVM options

The JPA Console runs in a separate Java process. You can run this process with custom JVM options by creating a run configuration and then selecting it when you open the console.

  1. Open the Run/Debug Configurations dialog:

    • In the main toolbar, click the run widget and select Edit Configurations….

    • Alternatively, go to Run | Edit Configurations….

  2. On the left side of the dialog, select Add New Configuration icon Add New Configuration | Application icon Application.

  3. On the right side of the dialog, select Modify options | Add VM options.

  4. In the VM options field, specify the options that you want to pass to the JVM when opening the JPA Console.

    VM options field in the Run/Debug Configurations dialog populated with -Xmx512m

    You can also set up other run configuration settings, but it is not required for the console.

  5. Click Apply and then OK.

  6. Open the Persistence tool window (View | Tool Windows | Persistence).

  7. Select a persistence unit.

  8. In the tool window toolbar, select JPA Console icon JPA Console | Application icon <Your Configuration Name>.

    Run configuration toolbar
  9. The JPA Console opens in a dedicated tool window with your JVM options applied. You can now run queries.

To learn what the icons in the console represent, refer to Reference: JPA Console.

Run queries

You can run queries in the JPA Console from either the console itself or from the editor.

IntelliJ IDEA runs your queries against a data source from the Database tool window. If there is more than one data source, the IDE looks for a match in the following configurations (in this order): a running Spring Debugger session, an explicit assignment in the Persistence tool window, or data source URL in Spring Boot configuration files. If IntelliJ IDEA cannot determine which data source to use, you will be prompted to select one.

Run a query from the JPA Console

  1. Open the JPA Console.

  2. Type or paste your query.

  3. In the console toolbar, click Green triangle pointing right Execute Query.

    • Alternatively, press Ctrl+Enter.

  4. If the query accepts parameters, the Parameters dialog opens. Specify the values and click Execute.

IntelliJ IDEA executes the query and opens its results in a new tab.

Run a query from the editor

  1. Place the caret at a query in the editor.

  2. Right-click the query and select Grey bulb icon Show Context Actions | Console icon Run query in console.

    • Alternatively, press Alt+Enter and select Console icon Run query in console.

  3. If the query accepts parameters, the Parameters dialog opens. Specify the values and click Execute.

IntelliJ IDEA executes the query and opens its results in the JPA Console.

Run a Spring Data query method from the editor

If your project uses Spring Data, you can run your repository methods right from the editor gutter. This feature is available for the following method types:

  • Methods where the query is derived from the method name

  • Methods annotated with @Query that define explicit JPQL or SQL queries

  • Methods annotated with @NativeQuery that define explicit SQL queries

  • Methods where the name references a @NamedQuery or a @NamedNativeQuery declared in the repository's entity class

  1. Open a Spring Data repository in the editor.

  2. In the gutter, click Console icon Run query in console next to a query method.

  3. If the query accepts parameters, the Parameters dialog opens. Specify the values and click Execute.

Convert Spring Data JPA method to JPQL

If you ran a JPQL query, the IDE opens the query's results in the JPA Console. If you ran a native SQL query, it opens the results in the Services tool window instead.

Reference: JPA Console

JPA Console with a JPQL query retrieving book authors with a specified nationality

The JPA Console is made up of the following components:

  1. Session tab: holds a single console session and includes the other components. The tab is named after the persistence unit.

  2. Main toolbar: lets you execute queries, configure query execution settings, and manage the console session.

  3. Console icon Output tab: displays the console log and lets you type queries. The tab is named after the persistence unit.

  4. Database table icon Result tab: displays the result of a single executed query and lets you customize how the result is displayed. Each query execution opens a new tab.

Main toolbar

Execute Query (Ctrl+Enter)

Run the currently typed query.

Settings

Open Query Execution Settings…

Open the Query Execution page in the Settings dialog.

Parameters

View Parameters

Open the Parameters pane to view the parameters accepted by the query and set their values.

History

Browse Query History (Ctrl+Alt+E)

Open the History dialog to view all the queries that you have run for this persistence unit and, optionally, copy a selected one to the console.

Restore Layout

Restore Default Layout

Restore the original console layout.

Terminate Process

Terminate Process (Ctrl+F2)

Disconnect the console from the database but keep the session tab open.

Close

Close (Ctrl+Shift+F4)

Disconnect the console from the database and close the currently open session tab.

Output tab

Wrapped text icon

Soft-Wrap

Wrap long lines in the console log.

Scrolled down text icon

Scroll to End

Jump to the bottom of the console log.

Printer icon

Print…

Open the Print dialog.

Trash bin icon

Clear All

Clear the console log.

Result tab

Table icon

Switch to Table

View the result in the form of a database table.

Learn more from Explore values.

Chart icon

Switch to Chart

View the result in the form of a chart.

Learn more from Visualize data.

Refresh icon

Reload Page (Ctrl+F5)

Reload the data.

Clock icon

Table Result Auto Refresh

Select how often the data should auto-refresh.

Pin icon

Pin Tab

Pin the currently open result tab.

Magnifying glass icon

Find on Current Page

Search the data on the currently displayed page for a specific value.

Filter icon

Table Result Local Filter

Enable filtering for all columns or clear all filters.

Learn more from Use the local filter.

Single record icon

Record View

Open a side pane to view the data in the selected record.

Learn more from Single record view.

Single record icon

Table Coloring Options

Configure color mapping for table cells.

Learn more from Apply a heatmap.

Web icon

Show Geo Viewer

Open an interactive map where you can view geocoordinates from the result.

Learn more from View geographical data.

Data extractor

Data Extractor

Select an output format for the data.

Learn more from Data extractors.

Download icon

Export Data (table view)

Open the Export Data dialog.

Export to PNG (chart view)

Download the chart as a PNG image.

Upload icon

Import

Open the Import dialog.

Diff icon

Compare Data

Compare this result with a result from a query console.

Eye icon

View as

Select a data view mode.

Learn more from Data view modes.

Gear icon

Show Options Menu (table view)

Open a list with the following options:

  • Show Value Editor: open the value editor to view the data from the selected cell.

  • Show Aggregate View: open the aggregate view.

  • Show Column List: display a list of all columns in the table.

  • Paste Format: select how to format text pasted from the clipboard.

  • Reset View: restore the initial table layout.

  • View Query: view the query that generated the result.

  • Copy Query to Console: copy the query to the console.

  • Copy Query to Clipboard: copy the query to the clipboard.

  • Open Data Views Settings: open the Data Editor and Viewer settings.

  • Open Data Views Appearance Settings: open the Data Editor and Viewer appearance settings.

Show Series Settings (chart view)

Open the Series Settings pane to configure the chart display options.

Productivity tips

Retrieve all records from an entity's table

You can quickly retrieve all records from a database table by invoking a dedicated action in its entity class. This executes a SELECT entity FROM <ClassName> entity statement in the JPA Console.

  1. Open an entity class in the editor.

  2. In the gutter, select Database icon with a blue table icon in the lower-right corner Show Entity actions | Console icon Run Query in JPA Console.

    • Alternatively, place the caret at the class name, press Alt+Enter, and select Console icon Run Query in JPA Console.

You can quickly navigate to an entity class declaration or an entity field declaration from any JPQL, HQL, or EQL query. This applies to queries in both the JPA Console and in the editor.

  • Hold Ctrl and click an entity name or field name in the query.

  • Place the caret at an entity name or field name in the query and press Ctrl+B.

  • Place the caret at an entity name or field name in the query. From the main menu, select Navigate | Declaration or Usages.

11 September 2026