FileDocCategorySizeDatePackage
ForeignReferenceQueryKey.javaAPI DocGlassfish v2 API5778Tue May 22 16:54:50 BST 2007oracle.toplink.essentials.querykeys

ForeignReferenceQueryKey

public class ForeignReferenceQueryKey extends QueryKey

Purpose: Define an alias to a foreign object.

Responsibilities:

  • Define the reference class of the foreign object.

Fields Summary
protected Class
referenceClass
protected String
referenceClassName
protected Expression
joinCriteria
Constructors Summary
Methods Summary
public voidconvertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this project to actual class-based settings

param
classLoader

        Class referenceClass = null;
        try{
            if (referenceClassName != null){
                if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
                    try {
                        referenceClass = (Class)AccessController.doPrivileged(new PrivilegedClassForName(referenceClassName, true, classLoader));
                    } catch (PrivilegedActionException exception) {
                        throw ValidationException.classNotFoundWhileConvertingClassNames(referenceClassName, exception.getException());
                    }
                } else {
                    referenceClass = oracle.toplink.essentials.internal.security.PrivilegedAccessHelper.getClassForName(referenceClassName, true, classLoader);
                }
            }
            setReferenceClass(referenceClass);
        } catch (ClassNotFoundException exc){
            throw ValidationException.classNotFoundWhileConvertingClassNames(referenceClassName, exc);
        }
    
public oracle.toplink.essentials.expressions.ExpressiongetJoinCriteria()
PUBLIC: Return the join expression for the relationship defined by the query key.

        return joinCriteria;
    
public java.lang.ClassgetReferenceClass()
PUBLIC: Return the reference class of the relationship.

        return referenceClass;
    
public java.lang.StringgetReferenceClassName()
PUBLIC: Return the reference class name of the relationship.

        if (referenceClassName == null && referenceClass != null){
            referenceClassName = referenceClass.getName();
        }
        return referenceClassName;
    
public booleanisForeignReferenceQueryKey()
INTERNAL: override the isForeignReferenceQueryKey() method in the superclass to return true.

return
boolean

        return true;
    
public voidsetJoinCriteria(oracle.toplink.essentials.expressions.Expression joinCriteria)
PUBLIC: Set the join expression for the relationship defined by the query key.

Example:

builder.getField("ADDRESS.ADDRESS_ID").equal(builder.getParameter("EMPLOYEE.ADDR_ID");

        this.joinCriteria = joinCriteria;
    
public voidsetReferenceClass(java.lang.Class referenceClass)
PUBLIC: Set the reference class of the relationship. This is not required for direct collection query keys.

        this.referenceClass = referenceClass;
    
public voidsetReferenceClassName(java.lang.String referenceClassName)
PUBLIC: Set the reference class name for this relationship This is used when projects are built without using classes

param
referenceClassName

        this.referenceClassName = referenceClassName;