JPAQL: Will it become usable soon?

I've noticed that very little progress has been made with JPAQL in the last few builds, so was wondering on whether it'll be improved over its rather sorry current state or scrapped.

Some issues:

Poor/non-functional named query support:
- Highlighting only seems to be done for inline queries, not named ones (eg, in @NamedQuery), they show up as plain strings
- Can't find usages on a named query
- Can't 'go to declaration' on a em.createNamedQuery("somename") - Should be able to go to declaration when cursor is in 'somename'.

Highlight/colouring issues:
- The query highlighting always bitches that it can't find the entity being queried. I don't see how you can figure out what the entity manager is, so safest approach is just to look through all persistence units for a matching entity name.
- Highlighter doesn't seem to really understand ejbql, this query is highlighted as invalid:
'select size(c.items) ....'

9 comments

Poor/non-functional named query support:
- Highlighting only seems to be done for inline queries, not named ones
(eg, in @NamedQuery), they show up as plain strings

Strange. It should work and event works in my examples. Could you provide
more detailed information, maybe, in JIRA?

- Can't find usages on a named query
- Can't 'go to declaration' on a em.createNamedQuery("somename") - Should
be able to go to declaration when cursor is in 'somename'.

There is an issue for this: http://www.jetbrains.net/jira/browse/IDEA-9065.

Highlight/colouring issues:
- The query highlighting always bitches that it can't find the entity
being queried. I don't see how you can figure out what the entity manager
is, so safest approach is just to look through all persistence units for a
matching entity name.

Once again, everything works for me. Need more information and JIRA request.


0

Could the issue be related to the fact that I don't have any persistence units defined in IDEA? I have my persistence.xml in one ejb module, and in other java only modules. I can't add them as persistence units in IDEA since they're not EJB modules or packages as part of the EE app. I'm told PU handling is being reworked so maybe that'd fix my issues...

0

Hani Suleiman wrote:

- Highlighter doesn't seem to really understand ejbql, this query is highlighted as invalid:
'select size(c.items) ....'


'size' function is not aggregate and allowed only in WHERE/HAVING
according to EJB3 spec. Perhaps, Hibernate allows such QL :)


--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Hello Hani,

Are your queries on a single line? I get syntax highlighting and even some
completion when I keep the queries on a single line (http://www.jetbrains.net/jira/browse/IDEA-9096
is the report for having issues with them when on multiple lines).

Andrei


0

Nothing for me, I have this for example inside of an entity in a java module:

@NamedQuery(name="navpoint.type", query="select n from NavPoint n where n.type=:type")

and the query is shown as a string, with no highlighting or error checking.

0

My PU's are detected nicely in 5692, so that's all good. A lot of my QL now works, but the most annoying thing by far is the fact that table and column names for some reason are flagged as invalid, so for example:

@Table(name="announce_item")

has a 'cannot resolve symbol' error for the name value.

Due to this, I cannot rely on IDEA's build project, any chance of having a toggle for disabling QL checking (similar to jasper validation) just so the build can proceed?

Of course,the ideal would be for all QL to always work, but that might be asking a bit much, especially when you consider some vendors allowing certain 'extension' QL and others not doing so.

0

Hi Hani,

I have the JPA classes inside an ejb module, so things might behave differently because of that. However, you might want to try the following (if you don't have them configured already).

Create a datasource for the schema you have your JPA classes mapped to. Upon having a schema present, IDEA offers me an intention to assign the class to a defined datasource. Once I accept that, the following gets inserted in my persistence.xml file:

]]>

where the value is the name of the datasource (coinciding with the schema, for me). If you don't get the intention, you might try to put the property in the persistence.xml config file to see if it makes a difference.

After this, not only do I get the validation OK, but IDEA helps with Ctrl+Space suggestions for table and column names as well.

HTH,
Andrei

0

Aha! Adding a DS helped, but of course, uncovered the next set of issues!

1) My queries are still not detected as being valid, the autocompletion for example only shows annotated fields (either with @Transient, or relation ones). Regular fields don't show up, and they should.

2) More of an question than an issue ,if I commit my .ipr file with the table definitions in it, then will other people also need to connect to the DS, or will the table info be sufficient?

3) It'd be nice if the DS tables go in the ipr file, but the actual DS connection info (eg, password) is store in iws.

0

Please sign in to leave a comment.