Community
Participate
Working Groups
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.
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