History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-24155
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Peter Gromov
Reporter: Kenneth Christensen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

QL inspection flags error

Created: 19 Dec 07 14:27   Updated: 18 Jan 08 13:05
Component/s: Editor. Error Highlighting
Fix Version/s: Diana 8243, Selena 7.0.3

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: None
Image Attachments:

1. ql-error1-ok-using-in.jpg
(72 kb)

2. ql-error1.jpg
(77 kb)

3. ql-error2.jpg
(61 kb)
Environment: EJB3

Build: 7,590
Fixed in build: 8,105
Severity: High


 Description  « Hide
Two errors (see attachments):

Error #1.

select f from Food f where f.id = (select fn.foodId from FoodName fn where (fn.name = :name or lower(fn.name) like :nameLowercase) group by fn.foodId) and (f.user.id is null or f.user.id = :userId or f.id = (select f2.id from Food f2, User u where f2.user.id = u.id and u.class = 'Sponsor'))

The above query is a valid one !

IDEA handles the query correctly when I replace '=' with 'in' (see attachment), but I don't want to use 'in' because MySQL performance declines when 'in' is used instead of '=' !

Error #2.

select f from Food f where f.id = (select fn.foodId from FoodName fn where (fn.name = :name or lower(fn.name) like :nameLowercase) group by fn.foodId) and (f.user.id is null or f.user.id = :userId or f.id = (select f2.id from Food f2, User u where f2.user.id = u.id and u.class = 'Sponsor'))

Looks like IDEA don't like x.class !



 All   Comments   Work Log   Change History      Sort Order:
Peter Gromov - 30 Dec 07 17:13
How did you manage to create 'class' attribute?

Kenneth Christensen - 30 Dec 07 18:54
Sorry - I'm mixing HQL and EJB-QL in my queries !

I'm using JBoss EJB3/JPA (JBoss 4.2.2.GA) implementation aka Hibernate.

http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/queryhql.html:

Likewise, the special property class accesses the discriminator value of an instance in the case of polymorphic persistence.
A Java class name embedded in the where clause will be translated to its discriminator value. Once again, this is specific to HQL.

select cat from Cat cat where cat.class = DomesticCat