Persistence QL Problem on cast(...)
I have inspection Java EE Issues > Persistence QL Problems enabled in my IntelliJ (v95.214). It works fine except it reports error on
HQL cast(... as ...)expresion:

Hibernate accepts this construction without problem. Underlying database is MS SQL Server 2005.
Please sign in to leave a comment.
Hibernate treats this as HQL and not JPAQL.
HQL injection occurs in the following cases:
Hibernate facet present
Hibernate provider is set as persistence provider in JPA facet persistence.xml.
It is directly configured in Settings/Language Injection instead of JPAQL
On 02.07.2010 15:55, Petras - wrote:
>
>
Gregory Shrago, thank you for your reply.
In my project:
But it didnt change anything - inspection still reports the same problem. Nothing changes even if I extract query string and put language injection annotation:
@org.intellij.lang.annotations.Language("HQL")
String query = "select cast(count(c) as integer) from ItuStatus c where c.link.id = :linkId";
I got it.
Even the ticket is here.
http://youtrack.jetbrains.net/issue/IDEA-20921
On 04.07.2010 15:35, Petras - wrote:
>
>
>
>
I see. It seems it's an old issue. And today I see it is just has been fixed! Thank you, Gregory, for assistance.
Thank you for your interest.
It's a common practice that a ticket priority is altered by YouTrack votes and forum requests. :)
Gregory Shrago
On 08.07.2010 13:52, Petras - wrote:
>
>
Hi, i am fighting with the same problem in my project and based on this discussion could not fix the problem. :(
I migrated my project from IntelliJ 6. I have configured a Hibernate facet. I also have the 2 settings specified for "Settings/Language Injection".
I have created a JPA facet, but i'm not sure how to configure it. Can somebody please point out what i have to do?