| Summary: | Improve usability of additional criteria applied to queries at the session/EM | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Doug Clarke <douglas.clarke> | ||||||||||
| Component: | Eclipselink | Assignee: | Guy Pelletier <guy.pelletier> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | enhancement | ||||||||||||
| Priority: | P2 | CC: | eclipselink.foundation-inbox, fs5, gordon.yorke, guy.pelletier, karenfbutzke | ||||||||||
| Version: | unspecified | ||||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| URL: | http://wiki.eclipse.org/EclispeLink/Development/AdditionalCriteria | ||||||||||||
| Whiteboard: | |||||||||||||
| Bug Depends on: | |||||||||||||
| Bug Blocks: | 312910 | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Doug Clarke
Created attachment 180495 [details]
Proposed changes
Created attachment 180817 [details]
Updated patch
After review from Gordon and James.
Created attachment 181006 [details]
Updated patch
Patch updated after review from Gordon.
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 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
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 {}
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |