Projects:HQL Query Tool Distribution Inclusion/Specs
HQL Query Tool is an external Openbravo module that allows to execute HQL queries. It is targeted to Openbravo developers enabling them to test queries when developing new functionalities.
It has been proved to be a useful tool and, because of it, it has been decided it makes sense to be included as part of the Openbravo 3 distribution.
HQL Query Tool was initially published in 2009 as a 2.50 module. Since then there has been few maintenance. It is still implemented using 2.50 technology.
- Text area to write HQL queries
- Execute button, when clicked it executes all the text as a query
- Results: displayed in a table (up to 10000 records)
- Properties visualization: Allows to select an entity (it also displays physical table name) and displays all Hibernate properties for it. It also links to the entity description in Developers Guide
Requirements to be included in Openbravo 3 distribution
Reimplement with Openbravo 3 technology
Additional components implemented with 2.50 technology should not be included in Openbravo 3 distribution. Therefore, HQL Query Tool must be reimplemented using Openbravo 3 technology: View Implementation based on SmartClient.
Preserve current functionality
At least, existing functionality must be preserved or improved.
Nice to have
In addition, some improvements on existing functionalities and new utilities could be included.
Query result visualization
- Instead of visualizing results in an HTML table, they could be visualized in a grid (without filtering nor sorting capabilities).
- Paginated results in grid. Currently up to 10000 results are visualized, they are fetched in a single result. This 10000 limit could be removed and replaced with paginated grid population.
Keyboard shortcut to execute query
Currently Execute button must be clicked using the mouse. It would be useful to define a shortcut so query can be launched after typing without need of using the mouse.
Partial query execution
Currently the whole text is used as query, in case of writing several queries it requires to delete previous one before executing the following one.
Having part of the text selected, only this part should be considered as the query to execute (similar behavior as ie. pgAdmin).
Improved properties visualization
- When selecting the entity it should be possible to filter by entity name or phyisical table name.
- In addition to property name, for those properties that have a physical column, it should also appear.
- It should be possible to filter and sort by property/column name, which would be useful for entities with many properties.
Show actual SQL
HQL queries are parsed and executed as SQL in database. In order to make optimizations in HQL queries, it would be very useful to know the SQL that is actually executed.
Keep query history
It would be useful to keep a history of executed queries, so they can be reused in other sessions.
Easier to find errors
When a query cannot be executed, currently the whole stack trace of the error is displayed (see image).
As part of this stack it usually points to the position it occurred:
org.postgresql.util.PSQLException: ERROR: syntax error at or near "column" Position: 2845
It would be useful to, at least, have an easy way to navigate to that position.
Kill execution of a query
When a query takes too long this may kill server so it would be nice to have an option to kill execution of the query.
Dialogue requesting parameters
When a query points to named parameters these could be requested to the user when executing the query.
Allow to select language to execute the query (SQL/HQL). In this way it would also be a replacement for current SQL Query window which is already in distribution and implemented with 2.50 technology.
It would be useful to have an assistant to complete queries which would propose valid HQL code while typing. Such as pgAdmin does.
It would be nice if reserved HQL words would be highlighted with a different color/style from the rest of the words in the query.