IntelliJ IDEA 13.1 Web Help

Some features described here are available in Ultimate edition only.

From the Persistence tool window (for a persistence unit or any node within it):

  • ConsoleOnTitleBar on the title bar
  • Console from the context menu
  • Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Ctrl+Shift+F10Shift Command F10Shift Command F10Shift Command F10

When you open the JPA Console tool window, first, the input pane opens. This is where you compose your JPQL queries.

JPAConsoleInput

Then, when you run your first query (runBuild), the output pane opens above the input pane. Basically, this is the log of operations performed in the console.

If your query retrieves data (e.g. select), also the Result pane opens showing the retrieved data in table format.

JPAConsoleInputOutputResult

Additionally, you can open the Parameters pane (property_yellow) to manage parameters in your queries.

JPAConsoleInputOutputResultParams

On this page:

See also, Working with the JPA Console.

Toolbar icons and shortcuts

Most of the functions in the Hibernate Console tool window are accessed by means of the toolbar icons and associated keyboard shortcuts.

Item Shortcut Description
runBuild Execute Query Ctrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCommand EnterCommand EnterCommand Enter Use this icon or shortcut to run the current query.
icon_sqlCopyQuery Generate SQL Ctrl+Shift+EnterCtrl+Shift+EnterCtrl+Shift+EnterCtrl+Shift+EnterCtrl+Shift+EnterCtrl+Shift+EnterCtrl+Shift+EnterCtrl+Shift+EnterCtrl+Shift+EnterShift Command EnterShift Command EnterShift Command Enter Use this icon or shortcut to generate an SQL equivalent of the current query.

The generated SQL statement will be shown in the output pane.

DDLCopy Generate DDL Ctrl+Shift+Alt+EnterCtrl+Shift+Alt+EnterCtrl+Shift+Alt+EnterCtrl+Shift+Alt+EnterCtrl+Shift+Alt+EnterCtrl+Shift+Alt+EnterCtrl+Shift+Alt+EnterCtrl+Shift+Alt+EnterCtrl+Shift+Alt+EnterShift Alt Command EnterShift Alt Command EnterShift Alt Command Enter Use this icon or shortcut to generate DDL SQL statements (CREATE TABLE, ALTER TABLE and DROP TABLE) for all the objects (classes) associated with the corresponding persistence unit.

The generated statements will be shown in the output pane.

consoleHistory Ctrl+Alt+ECtrl+Alt+ECtrl+Alt+ECtrl+Alt+ECtrl+Alt+ECtrl+Alt+ECtrl+Alt+ECtrl+Alt+ECtrl+Alt+EAlt Command EAlt Command EAlt Command E Use this icon or shortcut to open a dialog that shows all the queries that you have run in the console.

See also, Running auto-memorized queries.

settings Settings Use this icon to open the Database page of the Settings dialog to view or edit the settings for the Database, Hibernate and JPA consoles, the Table Editor and the Database tool window.
property_yellow View Parameters Use this icon to open or close the Parameters pane.
DBConsoleTWLayout Restore Layout Use this icon to restore the original tool window layout (after the rearrangements that you have made).
stop Terminate Process Use this icon or shortcut to terminate execution of the current query.
close Close Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+Shift+4Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+Shift+F4Ctrl+WControl Shift F4Shift Command F4Command W Use this icon or shortcut to close the console.

Output pane

This pane shows the queries that you have run as well as the information about their execution. When errors occur, the corresponding information is also shown in this pane.

For each of the events (queries and errors), the following information is provided:

  • Timestamp, that is, when the event took place.
  • For data manipulation operations - how many rows were affected (e.g. changed or deleted). For data retrieval operations - how many rows were retrieved.
  • Duration in milliseconds. If the query execution involves processing the data received from the database, the execution time is shown as x/y ms, where x is the time taken to receive the data, and y is the total time of generating the query result which includes both receiving and processing the data.

Use the following context menu commands:

  • Copy (Ctrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+Insert, Alt+C or Escape, WCtrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCtrl+C or Ctrl+InsertCommand C or Command InsertCommand C or Command InsertCommand C or Command Insert) to copy the text selected in the output pane to the clipboard.
  • Compare with Clipboard to compare the text selected in the output pane with the contents of the clipboard.
  • Clear All to clear all the contents of the output pane.

Result pane

This pane shows the data retrieved from the database in table format. You can sort the data as well as perform other, associated tasks.

Main functions. Most of the functions in the Result pane are accessed by means of controls on the toolbar, context menu commands for the data cells, and associated keyboard shortcuts.

Item Shortcut Description
dataSourceTableEditorFirstPage, dataSourceTableEditorPreviousPage, dataSourceTableEditorNextPage and dataSourceTableEditorLastPage These icons and corresponding commands are for switching between the result set pages, i.e. the pages that show the retrieved data.

A fixed number of rows shown simultaneously is referred to as a result set page. If this number is less than the number of rows that satisfy the query, only a subset of all the rows is shown at a time.

In such cases, you can use dataSourceTableEditorFirstPage, dataSourceTableEditorPreviousPage, dataSourceTableEditorNextPage and dataSourceTableEditorLastPage to switch between the subsets. (If all the rows are currently shown, these icons and the corresponding commands are inactive.)

The result set page size is set on the Database page of the Settings dialog.

dataSourceTableEditorFirstPage First Page Use this icon or command to switch to the first of the result set pages to see the first series of rows.
dataSourceTableEditorPreviousPage Previous Page Ctrl+Alt+UpCtrl+Alt+UpCtrl+Alt+UpCtrl+Alt+UpCtrl+Alt+UpCtrl+Alt+UpCtrl+Alt+UpCtrl+Alt+UpCtrl+Alt+UpAlt Command UpAlt Command UpAlt Command Up Use this icon, command or shortcut to switch to the previous result set page to see the previous series of rows.
dataSourceTableEditorNextPage Next Page Ctrl+Alt+DownCtrl+Alt+DownCtrl+Alt+DownCtrl+Alt+DownCtrl+Alt+DownCtrl+Alt+DownCtrl+Alt+DownCtrl+Alt+DownCtrl+Alt+DownAlt Command DownAlt Command DownAlt Command Down Use this icon, command or shortcut to switch to the next result set page to see the next series of rows.
dataSourceTableEditorLastPage Last Page Use this icon or command to switch to the last of the result set pages to see the last series of rows.
refresh Reload Page Ctrl+RCtrl+RCtrl+RCtrl+RCtrl+RCtrl+RCtrl+RCtrl+RCtrl+RConsole.TableResult.ReloadCommand RConsole.TableResult.Reload Use this icon, command or shortcut to refresh the current table view. Use this function to:
  • Synchronize the data shown with the actual contents of the database.
  • Apply the Result set page size setting after its change.
DataExtractorButton Data Extractor Use this button or command to open a menu in which you can select an active data extractor. The Configure Extractors command in that menu opens the Data Extractors dialog that lets you manage the data extractors and their settings.

(A data extractor is a named set of settings that define how to convert table data into CSV, TSV and other formats.)

copyOpen / Copy All To Clipboard / Save All To File Use this icon and/or associated commands:
  • Copy All To Clipboard. Use this command to copy the table data onto the clipboard.
  • Save All To File. Use this command to save the table data in a file. In the dialog that opens, specify the location and name of the file.

Note:

  • The data extractor which is currently active is applied.
  • If only a subset of corresponding rows is currently shown, all the appropriate rows are copied to the clipboard or saved in a file anyway. (The number of rows currently shown may be limited by the Result set page size parameter.)
mainToolbarSave Save LOB Use this icon or command to save the large object (LOB) currently selected in the table in a file.
ResetColumnOrderAndVisibility Reset Columns Order and Visibility Use this icon to restore the initial table view after reordering or hiding the columns, or sorting the data. As a result, the data, generally, becomes unsorted, the columns appear in the order they are defined in the corresponding query, and all the columns are shown.
View Query Use this button to view the query which was used to generate the table. To close the pane where the query is shown, press EscapeEscapeEscapeEscapeEscape, Escape or Ctrl+GEscapeEscapeEscapeEscapeEscapeEscapeEscape.
Go To | Row Ctrl+GCtrl+GCtrl+GCtrl+GAlt+GCtrl+GCtrl+GCtrl+GCtrl+LCommand LCommand GCommand L Use this command or shortcut to switch to a specified row. In the dialog that opens, specify the row number to go to.

Using the header row. In the Result pane, you can use the cells in the header row (i.e. the row where column names are shown) for:

You can sort table data by any of the columns by clicking the cells in the header row.

Each cell in this row has a sorting marker in the right-hand part and, initially, a cell may look something like this: TableEditorHeaderCellUnsorted. The sorting marker in this case indicates that the data is not sorted by this column.

If you click the cell once, the data is sorted by the corresponding column in the ascending order. This is indicated by the sorting marker appearance: TableEditorHeaderCellSortAsc. The number to the right of the marker (1 on the picture) is the sorting level. (You can sort by more than one column. In such cases, different columns will have different sorting levels.)

When you click the cell for the second time, the data is sorted in the descending order. Here is how the sorting marker indicates this order: TableEditorHeaderCellSortDesc.

Finally, when you click the cell for the third time, the initial state is resorted. That is, sorting by the corresponding column is canceled: TableEditorHeaderCellUnsorted.

Here is an example of a table where data are sorted by two of its columns.

TableEditorSortedTable

To restore the initial "unsorted" state for the table, use ResetColumnOrderAndVisibility.

To reorder columns, use drag-and-drop for the corresponding cells in the header row. To restore the initial order of columns, use ResetColumnOrderAndVisibility.

TableEditorReorderColumns

To hide a column, right-click the corresponding header cell and select Hide column.

To show a hidden column:

  1. Do one of the following:
    • Right-click any of the cells in the header row and select Column List.
    • Press Ctrl+F12Ctrl+F12Ctrl+0Ctrl+F12Ctrl+F12Ctrl+F12Ctrl+F12Ctrl+F12 or Ctrl+Shift+F12Ctrl+F3 or Ctrl+OCommand F12Command F12Command O.

    In the list that appears, the names of hidden columns are shown struck through.

    TableResultPaneHideColumn

  2. Select (highlight) the column name of interest and press SpaceSpaceSpaceSpaceSpaceSpaceSpaceSpaceSpaceSpaceSpaceSpace.
  3. Press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter or EscapeEscapeEscapeEscapeEscape, Escape or Ctrl+GEscapeEscapeEscapeEscapeEscapeEscapeEscape to close the list.

To show all the columns, use ResetColumnOrderAndVisibility.

See also, Using the structure view to sort the data, and hide and show the columns.

Parameters pane

To open or close the Parameters pane, use property_yellow on the toolbar.

Shown in the two-column table are all the parameters detected in the input pane along with their values.

To start editing a value, double-click the corresponding table cell, or click the cell and press F2 or Alt+EnterF2 or Alt+EnterF2 or Alt+EnterF2 or Alt+EnterF2 or Alt+EnterF2 or Alt+EnterF2 or Alt+EnterF2 or Alt+EnterF2 or Alt+EnterF2 or Alt EnterF2 or Alt EnterF2 or Alt Enter. To indicate that you have finished editing a value, press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter or click a different cell. To quit the editing mode and restore an initial value, press EscapeEscapeEscapeEscapeEscape, Escape or Ctrl+GEscapeEscapeEscapeEscapeEscapeEscapeEscape.

When you select a row containing a parameter in the table, the corresponding parameter is highlighted in the input pane. Similarly, when you select the header row (Parameter - Value), the overall query is highlighted.

See Also

Procedures:

Web Resources: