Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Development/JPA 2.0/entity type expressions"
(→Entity Type Expression) |
|||
Line 16: | Line 16: | ||
===Public API=== | ===Public API=== | ||
* <source lang="java">public Expression getClassForInheritance()</source> | * <source lang="java">public Expression getClassForInheritance()</source> | ||
− | returns a Type expression operating on the base expression. Examples: | + | returns a Type expression operating on the base expression. The base expression must be an ObjectExpression. Examples: |
− | <source lang="java">expressionBuilder.get("project").getClassForInheritance().equals(LargeProject.class) </source> | + | <source lang="java">expressionBuilder.get("project").getClassForInheritance().equals(LargeProject.class) </source> |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
===Open Issues=== | ===Open Issues=== | ||
− | Method | + | Method name for the public expression api. The getClassForInheritance() used above was arbitrarily picked because getType() is difficult to interpret when reading expression code. Other options might be getEntityType() or getClassType(). |
Revision as of 15:56, 29 May 2009
Contents
Entity Type Expression
Issue Summary
JPA 2.0 introduces JPQL expressions that allow a query to restrict results based on class types. This feature will require functionality to be added to EclipseLink.
See JPA 2.0 section 4.4.8 and 4.4.9 for details.
General Solution
Expression Support will be required that can provide a comparison with an extracted discriminator value.
Native Expression Support
through EclipseLink Enhancement 277509 1)ReportQuery will need return Class objects that the Type expression correlates to 2) Type expressions need to be supported that take parameters and constants representing Java Classes that will evaluate to String/Int values used in these class's inheritance policy fields 3) Type expresions also need to operate on expressions representing relationships and entities, allowing them all to be compared
Public API
*public Expression getClassForInheritance()
returns a Type expression operating on the base expression. The base expression must be an ObjectExpression. Examples:
expressionBuilder.get("project").getClassForInheritance().equals(LargeProject.class)
Open Issues
Method name for the public expression api. The getClassForInheritance() used above was arbitrarily picked because getType() is difficult to interpret when reading expression code. Other options might be getEntityType() or getClassType().
Work Required
- Develop model for testing
- approx 1 day
- Update Processing
- approx 6 days - creating expression support: EclipseLink Enhancement 277509
- approx 3 days - updating Parser