This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 322008 - Improve usability of additional criteria applied to queries at the session/EM
Summary: Improve usability of additional criteria applied to queries at the session/EM
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Guy Pelletier CLA
QA Contact:
URL: http://wiki.eclipse.org/EclispeLink/D...
Whiteboard:
Keywords:
Depends on:
Blocks: 312910
  Show dependency tree
 
Reported: 2010-08-06 11:44 EDT by Doug Clarke CLA
Modified: 2022-06-09 10:10 EDT (History)
5 users (show)

See Also:


Attachments
Proposed changes (112.02 KB, patch)
2010-10-08 11:34 EDT, Guy Pelletier CLA
no flags Details | Diff
Updated patch (116.67 KB, patch)
2010-10-13 15:31 EDT, Guy Pelletier CLA
no flags Details | Diff
Updated patch (116.96 KB, patch)
2010-10-15 15:07 EDT, Guy Pelletier CLA
no flags Details | Diff
testcase for inheritance (4.83 KB, application/x-zip-compressed)
2010-10-16 06:35 EDT, Frank Schwarz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Clarke CLA 2010-08-06 11:44:18 EDT
EclipseLInk users can apply addition expressions on mappings and in the default queries of a descriptor as well as modifying queries in events and redirectors. These capabilities allow additional generic 'filtering' of query results to be applied. 

This enhancement will simplify the usage of these capabilities enabling these 'filters' to be more easily defined and used.
Comment 1 Guy Pelletier CLA 2010-10-08 11:34:16 EDT
Created attachment 180495 [details]
Proposed changes
Comment 2 Guy Pelletier CLA 2010-10-13 15:31:10 EDT
Created attachment 180817 [details]
Updated patch

After review from Gordon and James.
Comment 3 Guy Pelletier CLA 2010-10-15 15:07:06 EDT
Created attachment 181006 [details]
Updated patch

Patch updated after review from Gordon.
Comment 4 Guy Pelletier CLA 2010-10-15 15:24:18 EDT
Changes have been submitted.

Reviewed by: Gordon Yorke, James Sutherland

Add new additional criteria model (annotations and XML) and new tests to AdvancedJPAJunitTest and EntityMappingsAdvancedJUnitTestCase. 

- testAdditionalCriteriaModelPopulate
- testAdditionalCriteria
- testAdditionalCriteriaWithParameterFromEM1
- testAdditionalCriteriaWithParameterFromEM2
- testAdditionalCriteriaWithParameterFromEMF
- testComplexAdditionalCriteria
Comment 5 Frank Schwarz CLA 2010-10-16 06:31:45 EDT
The name @AdditionalCriteria is somewhat misleading as it is fundamentally JPQL and not (JPA-)Criteria. Would not just "@Restriction" or have been more appropriate?

And more importantly: Is inheritance addressed as well?

@AdditionalCriteria("this.deleted = false")
public class Person { }

@AdditionalCriteria("this.active = true")
public class Employee extends Person {}


And, this feature/annotation would suit associations also very well:

@OneToMany
@ReadOnly
@Restriction("project.active = true and project.dueDate < CURRENT_DATE")
private List<Project> overdueProjects
Comment 6 Frank Schwarz CLA 2010-10-16 06:35:38 EDT
Created attachment 181034 [details]
testcase for inheritance

Inheritance should be supported or otherwise there should be a validation exception while bootstrapping the EMF.

Model of the test case:

@AdditionalCriteria("this.deleted = false")
public class Person { }

@AdditionalCriteria("this.active = true")
public class Employee extends Person {}
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:10:12 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink