This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 235210

Summary: @NamedQuery expression type parse error
Product: javaee Reporter: matsa <matsa>
Component: PersistenceAssignee: Sergey Petrov <sj-nb>
Status: RESOLVED FIXED    
Severity: normal CC: pjiricka
Priority: P3    
Version: 7.3.1   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 232018    
Bug Blocks:    
Attachments: Simple EE7 project with single entity containing single self-joining query

Description matsa 2013-08-29 07:54:10 UTC
I've recently been converting some HQL expressions into @NamedQuery (the JPA kind).

Here's an example:

SELECT c.name FROM Connection AS c WHERE c.key = :key AND c.validTo = (SELECT MAX(c2.validTo) FROM Connection AS c2 WHERE c2.key = :key )

This query works as it should before and after the conversion but the editor indicates the following error:

"The left and right expressions type must be of the same type".

If I remove the MAX() around c2.validTo the message goes away (and breaks my query of course). Perhaps that fact can help locate the error?
Comment 1 Sergey Petrov 2013-08-29 08:12:09 UTC
Can you provide a sample with entities code also?
Comment 2 matsa 2013-08-29 09:43:32 UTC
Created attachment 139417 [details]
Simple EE7 project with single entity containing single self-joining query

Simple EE7 project with single entity containing single self-joining query.
Comment 3 Sergey Petrov 2013-09-04 08:47:25 UTC
thanks, nice sample
Comment 4 Sergey Petrov 2013-09-04 20:17:13 UTC
depends on https://bugs.eclipse.org/bugs/show_bug.cgi?id=416546
Comment 5 Sergey Petrov 2013-10-01 16:38:25 UTC
http://hg.netbeans.org/web-main/rev/2503cb719727 2.5.1