llms.txt: machine-readable documentation index. Markdown version of this page is also available.

IntelliJ IDEA 2026.3 Help

JPA Console

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

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

Prerequisites

Open the console

Open the JPA Console manually if you want to run JPQL, JDQL, 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.

The JPA Console runs the 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 a 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 their values and click Execute (or press Enter).

The JPA Console executes the query and displays 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 their values and click Execute (or press Enter).

The JPA Console executes the query and displays its results.

Run a Jakarta Data query method from the gutter

If your project uses Jakarta Data repositories, you can run their query methods right from the editor gutter.

  1. Open a Jakarta 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 their values and click Execute (or press Enter).

The JPA Console executes the query and displays its results.

Running a Jakarta Data repository method in the JPA Console using the gutter icon and filling out the parameter values

Run a Spring Data query method from the gutter

If your project uses Spring Data repositories, you can run their query methods right from the editor gutter.

  1. Open a Spring Data repository in the editor.

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

  3. If the query accepts parameters, the Parameters dialog opens. Specify their values and click Execute (or press Enter).

If the query is written in JPQL or derived from the method name, the JPA Console executes the query and displays its results.

Running a Spring Data repository method in the JPA Console using the gutter icon and filling out the parameter values

If the query is written in native SQL, a database-specific query console executes it, and the Services tool window displays its results.

Reference: JPA Console

JPA Console with frames marking different parts that make up the console

The JPA Console contains the following tabs and toolbars:

  1. Session tab

  2. Query toolbar

  3. Console icon Console tab

  4. Database table icon Result tab

When you run a query with parameters, the console opens the Parameters dialog and prompts you to specify or review their values.

Session tab and query toolbar

The session tab groups the query toolbar, console tab, and result tabs for a single JPA Console session. The tab name is based on the persistence unit.

The query toolbar lets you run queries, configure query execution settings, and control the console session:

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.

Console tab

The console tab lets you write queries, run them, and view the query log for the current console session. This tab uses the same name as the session tab.

The query log records the following information every time you run a query:

  • The executed query.

  • If the query ran successfully:

    • SQL statements sent to the database while the query was running, including statements that fetched related data. These are shown only in projects that use Hibernate as the persistence provider.

    • The number of retrieved rows or, if the query modified data, of affected rows.

    • The total time it took to run the query, broken down into time spent executing the query and time spent retrieving the results.

  • If the query failed:

    • Error messages that explain why the query failed.

    • A link that compiles the project and runs the query again. This is shown only for errors that suggest the project build is out of date.

In addition to the query log, this tab includes a toolbar that lets you navigate the log, print it, and format its entries:

Wrapped text icon

Soft-Wrap

Wrap long lines in the query log.

Scrolled down text icon

Scroll to End

Jump to the bottom of the query log.

Printer icon

Print…

Open the Print dialog.

Trash bin icon

Clear All

Clear the query log.

Result tab

The result tab displays the data retrieved by your query. Each query run opens a separate tab, even when you run the same query multiple times.

In addition to the retrieved data, this tab includes a toolbar that lets you browse, filter, and export that data:

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.

  • Manage Columns…: 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.

Parameters dialog

The Parameters dialog lets you review and specify values for query parameters. Each row in the dialog represents one parameter: its name, the part of the query where it is used, and an input field for its value.

Parameters dialog with an input field clicked, showing the accepted values of an enum parameter

In addition to entering values, you can use the dialog in the following ways:

  • Select a row to highlight the parameter in the console tab.

  • Click an empty input field to display the parameter's expected format or accepted values.

  • Press Enter to jump to the next empty input field.

After you specify all parameter values, you can run the query by clicking Execute or pressing Enter.

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, JDQL, 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.

03 November 2026