Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353142 - Validation show problems with NamedQuery with subquery in where clause
Summary: Validation show problems with NamedQuery with subquery in where clause
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 353017
  Show dependency tree
 
Reported: 2011-07-26 13:21 EDT by Pascal Filion CLA
Modified: 2022-06-09 10:34 EDT (History)
1 user (show)

See Also:
neil.hauge: review+


Attachments
Fix validating undeclared variables when a query has a subquery (6.83 KB, patch)
2011-07-26 13:23 EDT, Pascal Filion CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Filion CLA 2011-07-26 13:21:26 EDT
Copied from bug 353017 since the bug is actually in the Hermes parser.

Build Identifier: 20110615-0604

Validation tool shows problems in named queries which have subquery in where
clause. Example: 

@Entity
@Table(name="test_table")
@NamedQuery(name = "TestEntity.testQuery", query = "select t from TestEntity t
where t.id = (select max(tt.id) from TestEntity tt)")
public class TestEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    private Integer id;


    @Column(name="name", length=255)
    private String name;
}

Validation tool shows following errors:

Multiple markers at this line
    - The identification variable 't' is not defined in the FROM 
     clause.
    - The identification variable 't' is not defined in the FROM 
     clause.
    - The identification variable 'tt' is not defined in the 
     FROM clause.

Reproducible: Always

Steps to Reproduce:
1.Create entity class
2.Add javax.persistence.NamedQuery annotation to class with select query having
subquery in where clause
Comment 1 Pascal Filion CLA 2011-07-26 13:23:42 EDT
Created attachment 200381 [details]
Fix validating undeclared variables when a query has a subquery
Comment 2 Pascal Filion CLA 2011-07-28 13:47:24 EDT
Checked in the fix.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:34:25 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink