Roundtripping between @NamedQueries in Java editor and statements in HQL editor
-------------------------------------------------------------------------------
Key: HBX-919
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-919
Project: Hibernate Tools
Type: New Feature
Versions: 3.2beta10
Reporter: Joseph Marques
I find myself often wanting to tweak queries either because of feature requests, redesigns
at the calling layers, or bugs that were found in the system. In all of these
circumstances, I have to copy the existing query portion of some @NamedQuery definition
into the HQL editor, remove the string quotes and plus signs, tweak the query, then copy
it back into the annotation, and add the string quotes and the plus signs again. It would
be nice if there were tools to aide in this sequence.
Java Editor --> HQL Editor:
It would be nice to be able to highlight the query part of the @NamedQuery in the java
editor, right-click it, and select an option such as "Show in HQL Editor".
This may not seem like such a big deal when the entire query is expressed on a single
line, but that case is rare for me. Nearly all of my queries span at least 3 lines, many
of them 10 or more lines. There's even one query at the moment spanning 16 lines.
The span looks like:
@NamedQuery(name = "queryName",
query = "first fragment" +
"continued fragment" +
"continued fragment" +
...
"last fragment")
So, I'd like to be able to highlight everything including and between "first
fragment" and "last fragment" and push it to an HQL Editor. During the
push, I'd want the quotes and the plus signs to be removed so that the editor only
showed:
first fragment
continued fragment
continued fragment
last fragment
HQL Edtior --> Java Editor:
Then, as part of the roundtripping, I should be able to highlight a query in the HQL
editor and punt that back as the 'query' part of my @NamedQuery.
I'm thinking this second part might be implemented through a copy / paste operation in
one of two ways:
1) regular copy / special paste
Here, we piggyback on the existing copy operation. All the functionality for the reverse
part of the trip would come from a special paste operation that adds the string quotes and
plus signs as the data is pulled from the clipboard.
2) special copy / regular paste
Here, all the functionality for the reverse part of the trip would come from a special
copy operation that adds the string quotes and plus signs to the clipboard data. Then,
this pre-formatted string can be pasted anywhere with the standard paste operation.
---
A third, somewhat similar solution would be to bypass the copy / paste stuff altogether.
Instead, a user would copy / paste query fragments between the editors just as they do
today. Then, he or she would highlight the pasted contents in the target editor,
right-click, and select either "Hibernate Tools > Java2HQL" or
"Hibernate Tools > HQL2Java".
Thoughts?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira