HQLHQL EditorAn integrated HQL Editor is provided for HQL file types, associated by default to files with .hql extension. For your convenience Hibero also provides an HQL Scratch Pad editor ( Ctrl + Shift + O) which doesn't require a physical file, useful for quick prototyping of HQL queries. The HQL Editor provides Syntax Highlighting, Braces Matcher, Auto-Completion, Code Navigation, Find Usages, Rename/Move/Safe Delete refactorings, Code Formating, Surround With, Code Folding and Error Highlighting. Each HQL Editor includes a tabed pane with three tabs: Query Results shows the resuls of a query execution; Query Translator holds the translation to SQL; and Parameters shows the discovered query parameters.
Apart of using the mouse to select the visible tab, you may use the following actions:
HQL Query Execution
At any moment the user may decide to run (
Ctrl + F10) the HQL query being edited and the returned results, if any,
will be shown in the embedded Query Results panel at the botton of the HQL Editor.
The results table is sortable and the column resize strategy is user customizable, as well as whether to use an scrollable result set (JDBC driver and HQL query permitting) or a fixed list size. See the Settings section of the documentation for details. HQL Query Translation
The HQL Editor also provides a Query Translator panel which holds the translation of the HQL
query to SQL as it is generated by Hibernate. The translation to SQL can be set up to be done dynamically as the HQL query is edited or on demand ( Ctrl + Shift + T).
Parameters Auto-DiscoveryThe Parameters panel of the HQL Editor shows a table with all the parameters of the HQL query. This table displays the parameter position or name (for positional-style or EJBQL-style respectively), parameter type, and the value currently assigned to the parameter. The same as with the HQL Query Translation, the discovery of parameters can be set up to be done dynamically as the query is edited or on demand ( Ctrl + Shift + P).
The number of parameters, their position/name, and type is automatically discovered by Hibero, and the user only needs to assign the values (only for Hibernate 3.1.x or above, if Hibernate 3.0.x or 2.x is used then the type needs to be specified manually by the user).
Inline Parameter EditorThe HQL Editor also features a convenient inline parameter editor to quickly assign a value to a parameter. To use this feature position the caret at the desired parameter and press Alt + Insert (or click the mouse over the light bulb) and select 'Set parameter value' intention.
Show Parameter InfoAnother convenient feature of the HQL Editor is the ability to show all the relevant information about a parameter (position/name, type and value) with the help of the action. To use this feature, either move the caret to the desired parameter and press Ctrl + P, or hover the mouse over any discovered parameter.
Autoscroll from/to ParameterAutoscroll from/to Parameter helps the user to visually map the parameters between the query code and the parameters table. If Autoscroll from Parameter is selected then moving the caret to any parameter in the HQL code will select that parameter in the table. If Autoscroll to Parameter is selected then selecting a parameter in the table will highlight that parameter in the HQL code.
Quick HQL Query EditionFor those cases that you don't want to create a separate HQL file to edit a query Hibero provides a handy quick editor () available for Java string literals and named queries (i.e., HQL queries defined at XML mapping files or @javax.persitence.NamedQuery annotations).
This quick editor has exactly the same features as the standard HQL Editor, plus the option to cancel (Esc) any changes made to the query or to apply (Ctrl + Shift + X) such changes to the original query text. Quick HQL Query TranslationIf you just want to quickly see the translated SQL code for any given HQL query expressed in a Java string literal or named query then use the action.
|