This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 277509 - Need native expressions to support JPQL Entity Type filtering
Summary: Need native expressions to support JPQL Entity Type filtering
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 252009
  Show dependency tree
 
Reported: 2009-05-22 13:35 EDT by Chris Delahunt CLA
Modified: 2022-06-09 10:33 EDT (History)
0 users

See Also:


Attachments
proposed code change (28.95 KB, patch)
2009-05-28 14:32 EDT, Chris Delahunt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Delahunt CLA 2009-05-22 13:35:24 EDT
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));
Comment 1 Chris Delahunt CLA 2009-05-28 14:32:48 EDT
Created attachment 137533 [details]
proposed code change
Comment 2 Chris Delahunt CLA 2009-06-02 16:51:37 EDT
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.
Comment 3 Peter Krogh CLA 2009-08-26 09:53:42 EDT
Mass update to change fixed in target.
Comment 4 Peter Krogh CLA 2009-08-26 09:56:37 EDT
Mass update to change fixed in target.
Comment 5 Peter Krogh CLA 2009-08-26 10:02:16 EDT
Mass update to change fixed in target.
Comment 6 Peter Krogh CLA 2009-08-26 10:04:26 EDT
Mass update to change fixed in target.
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:33:54 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink