Community
Participate
Working Groups
As described in http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/entity_type_expressions the JPA 2.0 spec will allow JPQL queries to filter results based on the entity type, and also to return the entity type as a result. This is being filed to support this functionality in EclipseLink native expressions. Something along the lines of a getEntityType() api on Expression that 1) if used as an attribute on a ReportQuery will return the inheritance type field results, as the appropriate java class: ie JPQL "Select Type(p) From Project p" will be required to return Class objects for each mapped Project subclass. 2) can be used on parameters and class constants within expressions to convert them to the Inheritance type field representation ie LargeProject.class might be represented by 'L' in the database 3) Operate on query keys and other relationship expressions ie: expression = builder.get("project").getEntityType().equals(builder.getEntityType(LargeProject.class));
Created attachment 137533 [details] proposed code change
Patch checked in. Only change from uploaded patch is an api name change from getClassForInheritance() to type(). Expressions using this feature will look similar to: expressionBuilder.get("firstName").get("project").type().equals(LargeProject.class) the type() method will only operate on expressions on relationships or expressionbuilders that representing objects. These objects must use inheritance and use a descriminator field, or an invalidTypeExpression will be thrown.
Mass update to change fixed in target.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink