本文整理了Java中org.eclipse.persistence.internal.expressions.QueryKeyExpression.addDerivedExpression
方法的一些代码示例,展示了QueryKeyExpression.addDerivedExpression
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryKeyExpression.addDerivedExpression
方法的具体详情如下:
包路径:org.eclipse.persistence.internal.expressions.QueryKeyExpression
类名称:QueryKeyExpression
方法名:addDerivedExpression
暂无
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* ADVANCED:
* Return an expression that allows you to treat its base as if it were a subclass of the class returned by the base
* This can only be called on an ExpressionBuilder, the result of expression.get(String), expression.getAllowingNull(String),
* the result of expression.anyOf("String") or the result of expression.anyOfAllowingNull("String")
*
* downcast uses Expression.type() internally to guarantee the results are of the specified class.
* <p>Example:
* <pre><blockquote>
* EclipseLink: employee.get("project").treat(LargeProject.class).get("budget").equal(1000)
* Java: ((LargeProject)employee.getProjects().get(0)).getBudget() == 1000
* SQL: LPROJ.PROJ_ID (+)= PROJ.PROJ_ID AND L_PROJ.BUDGET = 1000 AND PROJ.TYPE = "L"
* </blockquote></pre>
*/
@Override
public Expression treat(Class castClass){
//to be used in 'where treat(t as PerformanceTireInfo).speedRating > 100'
QueryKeyExpression clonedExpression = new TreatAsExpression(castClass, this);
clonedExpression.shouldQueryToManyRelationship = this.shouldQueryToManyRelationship;
//using shouldUseOuterJoin to indicate the join to use between the t and PerformanceTireInfo subclass.
clonedExpression.hasQueryKey = this.hasQueryKey;
clonedExpression.hasMapping = this.hasMapping;
this.addDerivedExpression(clonedExpression);
return clonedExpression;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* ADVANCED:
* Return an expression that allows you to treat its base as if it were a subclass of the class returned by the base
* This can only be called on an ExpressionBuilder, the result of expression.get(String), expression.getAllowingNull(String),
* the result of expression.anyOf("String") or the result of expression.anyOfAllowingNull("String")
*
* downcast uses Expression.type() internally to guarantee the results are of the specified class.
* <p>Example:
* <pre><blockquote>
* EclipseLink: employee.get("project").treat(LargeProject.class).get("budget").equal(1000)
* Java: ((LargeProject)employee.getProjects().get(0)).getBudget() == 1000
* SQL: LPROJ.PROJ_ID (+)= PROJ.PROJ_ID AND L_PROJ.BUDGET = 1000 AND PROJ.TYPE = "L"
* </blockquote></pre>
*/
@Override
public Expression treat(Class castClass){
//to be used in 'where treat(t as PerformanceTireInfo).speedRating > 100'
QueryKeyExpression clonedExpression = new TreatAsExpression(castClass, this);
clonedExpression.shouldQueryToManyRelationship = this.shouldQueryToManyRelationship;
//using shouldUseOuterJoin to indicate the join to use between the t and PerformanceTireInfo subclass.
clonedExpression.hasQueryKey = this.hasQueryKey;
clonedExpression.hasMapping = this.hasMapping;
this.addDerivedExpression(clonedExpression);
return clonedExpression;
}
内容来源于网络,如有侵权,请联系作者删除!