Skip to main content
Jump to: navigation, search

Difference between revisions of "EclipseLink/DesignDocs/374771"

(New page: <div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__</div> = Design Specification: TREAT expression support = [http://bugs.eclipse.org/374771 ER 374771] == Do...)
 
(Concepts)
Line 21: Line 21:
  
 
== Concepts ==
 
== Concepts ==
 +
When creating a JOIN in a JPQL statement or Criteria API expression the type of the join is that of the corresponding attribute type.  Should the query writer wish to reference an attribute of a subclass of that JOIN type the query writer would use the TREAT function to effectively join to a subclass of the JOIN type and JOIN is treated as the specified subtype. 
 +
 +
  Select e from Employee e, JOIN TREAT(e.projects as LargeProject) l WHERE l.budget > 25000
 +
 +
In the case of this example the type of Employee.projects is Project.  Because the query writer wants to access an attribute of the subclass LargeProject TREAT is used.
  
 
== Requirements ==
 
== Requirements ==

Revision as of 15:17, 20 March 2012

Design Specification: TREAT expression support

ER 374771

Document History

Date Author Version Description & Notes
20 March 2012 Gordon Yorke Initial Document created

Project overview

JPA 2.1 will add support for a TREAT function within JPQL and criteria. Support will be required for both JPQL and Criteria queries.

Concepts

When creating a JOIN in a JPQL statement or Criteria API expression the type of the join is that of the corresponding attribute type. Should the query writer wish to reference an attribute of a subclass of that JOIN type the query writer would use the TREAT function to effectively join to a subclass of the JOIN type and JOIN is treated as the specified subtype.

 Select e from Employee e, JOIN TREAT(e.projects as LargeProject) l WHERE l.budget > 25000 
In the case of this example the type of Employee.projects is Project.  Because the query writer wants to access an attribute of the subclass LargeProject TREAT is used.

Requirements

Design Constraints

Design / Functionality

Testing

API

GUI

Config files

Documentation

Open Issues

This section lists the open issues that are still pending that must be decided prior to fully implementing this project's requirements.

Issue # Owner Description / Notes

Decisions

This section lists decisions made. These are intended to document the resolution of open issues or constraints added to the project that are important.

Issue # Description / Notes Decision

Future Considerations

During the research for this project the following items were identified as out of scope but are captured here as potential future enhancements. If agreed upon during the review process these should be logged in the bug system.

Back to the top