本文整理了Java中org.eclipse.persistence.internal.expressions.QueryKeyExpression.shouldQueryToManyRelationship
方法的一些代码示例,展示了QueryKeyExpression.shouldQueryToManyRelationship
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryKeyExpression.shouldQueryToManyRelationship
方法的具体详情如下:
包路径:org.eclipse.persistence.internal.expressions.QueryKeyExpression
类名称:QueryKeyExpression
方法名:shouldQueryToManyRelationship
[英]Is this a query across a 1:many or many:many relationship. Does not apply to attributes.
[中]
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Indicates that RelationExpression.normalize method shouldn't attempt
* optimize normalization by not normalizing this.
*/
public boolean isNormalizationRequired() {
return shouldQueryToManyRelationship() ||
// For bug 2718460, some QueryKeyExpressions have a query key but no mapping.
// An example is the "back-ref" query key for batch reads. Must not
// attempt the optimization for these.
getMapping() == null ||
// For bug 5234283: WRONG =* SQL FOR LEFT JOIN ON DERBY AND DB2 PLATFORMS
// Caused by QueryKeyExpression never been normilized.
// The condition should be kept in sync with condtions in normalize method
// that trigger adding to normalizer.getStatement().getOuterJoin...
((shouldUseOuterJoin() || isUsingOuterJoinForMultitableInheritance()) && !getSession().getPlatform().shouldPrintOuterJoinInWhereClause()) ||
(shouldUseOuterJoin() && getSession().getPlatform().isInformixOuterJoin());
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public void iterate(Expression expression) {
if (expression.isQueryKeyExpression() && ((QueryKeyExpression)expression).shouldQueryToManyRelationship()) {
// Aggregate should only use distinct as specified by the user.
if (!isDistinctComputed()) {
useDistinct();
}
}
}
};
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
@Override
public void iterate(Expression expression) {
if (expression.isQueryKeyExpression() && ((QueryKeyExpression)expression).shouldQueryToManyRelationship()) {
// Aggregate should only use distinct as specified by the user.
if (!isDistinctComputed()) {
useDistinct();
}
}
}
};
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
public void iterate(Expression expression) {
if (expression.isQueryKeyExpression() && ((QueryKeyExpression)expression).shouldQueryToManyRelationship()) {
// Aggregate should only use distinct as specified by the user.
if (!isDistinctComputed()) {
useDistinct();
}
}
}
};
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Return if the expression is equal to the other.
* This is used to allow dynamic expression's SQL to be cached.
*/
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!super.equals(object)) {
return false;
}
QueryKeyExpression expression = (QueryKeyExpression) object;
// Return false for anyOf expressions, as equality is unknown.
if (shouldQueryToManyRelationship() || expression.shouldQueryToManyRelationship()) {
return false;
}
return ((getName() == expression.getName()) || ((getName() != null) && getName().equals(expression.getName())));
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Return if the expression is equal to the other.
* This is used to allow dynamic expression's SQL to be cached.
*/
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!super.equals(object)) {
return false;
}
QueryKeyExpression expression = (QueryKeyExpression) object;
// Return false for anyOf expressions, as equality is unknown.
if (shouldQueryToManyRelationship() || expression.shouldQueryToManyRelationship()) {
return false;
}
return ((getName() == expression.getName()) || ((getName() != null) && getName().equals(expression.getName())));
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* Return if the expression is equal to the other.
* This is used to allow dynamic expression's SQL to be cached.
*/
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!super.equals(object)) {
return false;
}
QueryKeyExpression expression = (QueryKeyExpression) object;
// Return false for anyOf expressions, as equality is unknown.
if (shouldQueryToManyRelationship() || expression.shouldQueryToManyRelationship()) {
return false;
}
return ((getName() == expression.getName()) || ((getName() != null) && getName().equals(expression.getName())));
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Print java for project class generation
*/
@Override
public void printJava(ExpressionJavaPrinter printer) {
this.baseExpression.printJava(printer);
if (!shouldUseOuterJoin()) {
if (!shouldQueryToManyRelationship()) {
printer.printString(".get(");
} else {
printer.printString(".anyOf(");
}
} else {
if (!shouldQueryToManyRelationship()) {
printer.printString(".getAllowingNull(");
} else {
printer.printString(".anyOfAllowingNone(");
}
}
printer.printString("\"" + getName() + "\")");
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* Print java for project class generation
*/
@Override
public void printJava(ExpressionJavaPrinter printer) {
this.baseExpression.printJava(printer);
if (!shouldUseOuterJoin()) {
if (!shouldQueryToManyRelationship()) {
printer.printString(".get(");
} else {
printer.printString(".anyOf(");
}
} else {
if (!shouldQueryToManyRelationship()) {
printer.printString(".getAllowingNull(");
} else {
printer.printString(".anyOfAllowingNone(");
}
}
printer.printString("\"" + getName() + "\")");
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Print java for project class generation
*/
public void printJava(ExpressionJavaPrinter printer) {
getBaseExpression().printJava(printer);
if (!shouldUseOuterJoin()) {
if (!shouldQueryToManyRelationship()) {
printer.printString(".get(");
} else {
printer.printString(".anyOf(");
}
} else {
if (!shouldQueryToManyRelationship()) {
printer.printString(".getAllowingNull(");
} else {
printer.printString(".anyOfAllowingNone(");
}
}
printer.printString("\"" + getName() + "\")");
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
*/
public Vector getOwnedTables() {
if ((getMapping() != null) && getMapping().isNestedTableMapping()) {
Vector nestedTable = null;
if (shouldQueryToManyRelationship()) {
nestedTable = (Vector)super.getOwnedTables().clone();
} else {
nestedTable = new Vector(1);
}
nestedTable.addElement(new NestedTable(this));
return nestedTable;
}
if ((getMapping() != null) && (getMapping().isReferenceMapping() || getMapping().isStructureMapping())) {
return null;
}
return super.getOwnedTables();
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
*/
@Override
public List<DatabaseTable> getOwnedTables() {
if ((getMapping() != null) && getMapping().isNestedTableMapping()) {
List<DatabaseTable> nestedTable = null;
if (shouldQueryToManyRelationship()) {
nestedTable = new ArrayList(super.getOwnedTables());
} else {
nestedTable = new ArrayList(1);
}
nestedTable.add(new NestedTable(this));
return nestedTable;
}
if ((getMapping() != null) && (getMapping().isReferenceMapping() || getMapping().isStructureMapping())) {
return null;
}
return super.getOwnedTables();
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
*/
@Override
public List<DatabaseTable> getOwnedTables() {
if ((getMapping() != null) && getMapping().isNestedTableMapping()) {
List<DatabaseTable> nestedTable = null;
if (shouldQueryToManyRelationship()) {
nestedTable = new ArrayList(super.getOwnedTables());
} else {
nestedTable = new ArrayList(1);
}
nestedTable.add(new NestedTable(this));
return nestedTable;
}
if ((getMapping() != null) && (getMapping().isReferenceMapping() || getMapping().isStructureMapping())) {
return null;
}
return super.getOwnedTables();
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
if ((!shouldQueryToManyRelationship()) && qkIsToMany && (!isNestedMapping)) {
throw QueryException.invalidUseOfToManyQueryKeyInExpression(theOneThatsNotNull);
if (shouldQueryToManyRelationship() && !qkIsToMany) {
throw QueryException.invalidUseOfAnyOfInExpression(theOneThatsNotNull);
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
if ((!shouldQueryToManyRelationship()) && qkIsToMany && (!isNestedMapping)) {
throw QueryException.invalidUseOfToManyQueryKeyInExpression(theOneThatsNotNull);
if (shouldQueryToManyRelationship() && !qkIsToMany) {
throw QueryException.invalidUseOfAnyOfInExpression(theOneThatsNotNull);
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* Validate and prepare the join expression.
*/
protected void prepareJoinExpression(Expression expression, AbstractSession session) {
// Must be query key expression.
if (!expression.isQueryKeyExpression()) {
throw QueryException.mappingForExpressionDoesNotSupportJoining(expression);
}
QueryKeyExpression objectExpression = (QueryKeyExpression)expression;
// Expression may not have been initialized.
objectExpression.getBuilder().setSession(session.getRootSession(null));
if (objectExpression.getBuilder().getQueryClass() == null){
objectExpression.getBuilder().setQueryClass(this.descriptor.getJavaClass());
}
// Can only join relationships.
if ((objectExpression.getMapping() == null) || (!objectExpression.getMapping().isJoiningSupported())) {
throw QueryException.mappingForExpressionDoesNotSupportJoining(objectExpression);
}
// Search if any of the expression traverse a 1-m.
ObjectExpression baseExpression = objectExpression;
while (!baseExpression.isExpressionBuilder()) {
if (((QueryKeyExpression)baseExpression).shouldQueryToManyRelationship()) {
setIsToManyJoinQuery(true);
}
if (baseExpression.shouldUseOuterJoin()) {
setIsOuterJoinedAttributeQuery(true);
}
baseExpression = (ObjectExpression)baseExpression.getBaseExpression();
}
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
if ((!shouldQueryToManyRelationship()) && qkIsToMany && (!isNestedMapping)) {
throw QueryException.invalidUseOfToManyQueryKeyInExpression(theOneThatsNotNull);
if (shouldQueryToManyRelationship() && !qkIsToMany) {
throw QueryException.invalidUseOfAnyOfInExpression(theOneThatsNotNull);
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
if (((QueryKeyExpression)baseExpression).shouldQueryToManyRelationship()) {
setIsToManyJoinQuery(true);
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
if (((QueryKeyExpression)expression).shouldQueryToManyRelationship()) {
getJoinedAttributeManager().setIsToManyJoinQuery(true);
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
if (((QueryKeyExpression)baseExpression).shouldQueryToManyRelationship()) {
setIsToManyJoinQuery(true);
内容来源于网络,如有侵权,请联系作者删除!