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"
m |
|||
Line 11: | Line 11: | ||
==Native Expression Support== | ==Native Expression Support== | ||
− | through EclipseLink [http://bugs.eclipse.org/277509 | + | through EclipseLink [http://bugs.eclipse.org/277509 Enhancement 277509] |
1)ReportQuery will need return Class objects that the Type expression correlates to | 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 | 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 | 3) Type expresions also need to operate on expressions representing relationships and entities, allowing them all to be compared | ||
===Public API=== | ===Public API=== | ||
− | * <source | + | * <source>public Expression getClassForInheritance()</source> |
returns a Type expression operating on the base expression. Examples: | returns a Type expression operating on the base expression. Examples: | ||
− | <source lang="java">expressionBuilder.get("project").getClassForInheritance().equals(LargeProject.class)</source> | + | <source lang="java">expressionBuilder.get("project").getClassForInheritance().equals(LargeProject.class) </source> |
− | * <source lang="java">public Expression getClassForInheritance(Class clazz)</source> | + | * <source lang="java">public Expression getClassForInheritance(Class clazz) </source> |
This returns a Type expresssion using the clazz argument to form a ConstantExpression as its base expression. Example: | This returns a Type expresssion using the clazz argument to form a ConstantExpression as its base expression. Example: | ||
<source lang="java">expressionBuilder.getClassForInheritance().equals( (new ConstantExpression(LargeProject.class)).getClassForInheritance()) </source> | <source lang="java">expressionBuilder.getClassForInheritance().equals( (new ConstantExpression(LargeProject.class)).getClassForInheritance()) </source> | ||
− | * <source lang="java"> | + | * <source lang="java">public static Expression getClassForInheritance(Expression expression) </source> |
This static method follows the form of other functions in Expression, allowing the expression argument passed in to be used as the base expression. Example: | This static method follows the form of other functions in Expression, allowing the expression argument passed in to be used as the base expression. Example: | ||
− | <source lang="java">builder.getTable("PROJECT").getField("TYPE").equals(Expression.getInheritanceType(builder.getParameter("parameter1"))) </source> | + | <source lang="java">builder.getTable("PROJECT").getField("TYPE").equals(Expression.getInheritanceType(builder.getParameter("parameter1"))) |
+ | </source> | ||
− | ==Open Issues== | + | ===Open Issues=== |
Method names 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(). | Method names 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(). | ||
Line 36: | Line 37: | ||
#: approx 1 day | #: approx 1 day | ||
# Update Processing | # Update Processing | ||
− | #: approx 6 days - creating expression support | + | #: approx 6 days - creating expression support: EclipseLink [http://bugs.eclipse.org/277509 Enhancement 277509] |
− | + | ||
#: approx 3 days - updating Parser | #: approx 3 days - updating Parser |
Revision as of 15:53, 22 May 2009
Contents
Entity Type Expression
JPA 2.0 Root | Enhancement Request
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
*Invalid language.
You need to specify a language like this: <source lang="html4strict">...</source>
Supported languages for syntax highlighting:
4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, otj, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic
public Expression getClassForInheritance()
returns a Type expression operating on the base expression. Examples:
expressionBuilder.get("project").getClassForInheritance().equals(LargeProject.class)
public Expression getClassForInheritance(Class clazz)
This returns a Type expresssion using the clazz argument to form a ConstantExpression as its base expression. Example:
expressionBuilder.getClassForInheritance().equals( (new ConstantExpression(LargeProject.class)).getClassForInheritance())
public static Expression getClassForInheritance(Expression expression)
This static method follows the form of other functions in Expression, allowing the expression argument passed in to be used as the base expression. Example:
builder.getTable("PROJECT").getField("TYPE").equals(Expression.getInheritanceType(builder.getParameter("parameter1")))
Open Issues
Method names 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