Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
No Fix versions
State
Obsolete
Assignee
Alexey Kudravtsev
Subsystem
J2EE.Hibernate
Affected versions
No Affected versions
Fixed in build
No Fixed in build
  • Created by   Taras Tielkes
    4 years ago (19 May 2007 14:56)
  • Updated by   root
    2 years ago (17 Jan 2010 20:46)
  • Jira: IDEADEV-17198
    (history, comments)
 
IDEA-38623 Preview for "rename" in injected HQL gets confused between injected language and outer file
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
Hibernate facet is configured for current module.
A Dao class in the module looks like this:
public class BazDAO extends HibernateDaoSupport {
    public List findSomething() {
        final HibernateTemplate templ = getHibernateTemplate();
        return templ.executeFind(new HibernateCallback() {
            public Object doInHibernate(final Session session) {
                final String hql =
                    "from Baz baz where baz.barId = 1 and baz.fooId = 2";
                final Query query = session.createQuery(hql);
                return query.list();
            }
        });
    }
}


In the injected HQL, invoke Refactor->Rename for the alias "baz" used in the embedded HQL query. Choose Preview.

Shown preview has three problems:
1) Current Java file is shown with "excluded" icon (it has regular Java icon in normal editor tab, as expected)
2) Error markers are shown for the preview of the Java file that will be affected (because it's interpreted as HQL?)
3) Occurence highlighting inside preview window is incorrect: it seems to apply the character index values for the injected fragment to the outer file

In addition, perhaps "Unclassified usage" could be something more descriptive?

Note that running a preview for an entity query alias is a bit silly, since occurrences are always limited to the query.
However, I've seen similar errors for other rename actions affecting HQL, for example: renaming entity itself.

Issue was resolved
Comments (2)
 
History
 
Linked Issues (?)
 
Alexander Chernikov
  Alexander Chernikov
06 Oct 2007 21:24
4 years ago
7331: problems 2, 3 and "unclassified usage" are avoided.
But the problem 1 persists. The file icon is "excluded java".
Taras Tielkes
  Taras Tielkes
06 Oct 2007 21:40
4 years ago
Note that there is also a separate issue for file icon for usages in injected context: IDEA-13994