Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353017 - Validation show problems with NamedQuery with subquery in where clause
Summary: Validation show problems with NamedQuery with subquery in where clause
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 3.0.1   Edit
Assignee: Pascal Filion CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 353142
Blocks:
  Show dependency tree
 
Reported: 2011-07-25 11:40 EDT by Mariusz Tusiński CLA
Modified: 2011-08-25 12:16 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mariusz Tusiński CLA 2011-07-25 11:40:03 EDT
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 Neil Hauge CLA 2011-08-23 17:52:26 EDT
This was fixed in EclispeLink and the build has been updated to include this new build.
Comment 2 Jolene Moffitt CLA 2011-08-25 12:16:59 EDT
Verified in Build I-3.4.0-20110822071621 

Verified if you add a named queries which has a subquery in where
clause no id variable errors appear. See the link to view test steps for verification.  http://wiki.eclipse.org/Dali_3.0.1