abstract class AbstractJoin
extends java.lang.Object
Instances of this class are enclosed within query objects and are used at query prepare time and at query execution time to augment the query with the necessary join semantics.
DynamicJoin,
ServerJoin| Modifier and Type | Field and Description |
|---|---|
private FQLExpression[][] |
fql
FQL where clause snippet used to perform the join
|
protected BufferReference |
inverse
Buffer to which this component should join via a foreign relation.
|
private java.lang.Class<? extends DataModelObject> |
inverseIface
DMO interface for the inverse (non-local) end of the join
|
static int |
NOT_NULL_FIELD
The index of fql expression for
not null fields. |
static int |
NULL_FIELD
The index of fql expression for
null fields. |
private java.util.List<FqlType> |
parameterTypes
Hibernate types of query substitution parameters (null if none)
|
| Constructor and Description |
|---|
AbstractJoin(RecordBuffer local,
RecordBuffer inverse)
Constructor which invokes abstract initialization methods in subclass
implementations.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract FQLExpression[][] |
generateFQL(RecordBuffer local,
RecordBuffer inverse,
RelationInfo info,
boolean dereference)
Generate the set of FQL where clause snippets which will be inserted into the overall FQL statement
executed by the enclosing query.
|
(package private) FQLExpression[][] |
getFQL()
Get the FQLs for the where clause snippet used to perform the join.
|
BufferReference |
getInverse()
Return the inverse buffer used with this join, if any.
|
(package private) java.lang.Class<? extends DataModelObject> |
getInverseInterface()
Get the DMO interface for the inverse (non-local) end of the join.
|
(package private) java.util.List<java.io.Serializable> |
getParameters()
Get the values of DMO instance fields or the DMO instance itself which
will be used as the query substitution parameter(s).
|
(package private) java.util.List<FqlType> |
getParameterTypes()
Get the type of the query substitution parameters, if any, which was
determined at construction.
|
protected abstract java.util.List<FqlType> |
getParameterTypes(RelationInfo info,
boolean dereference)
Determine the Hibernate type of the query substitution parameters, if any.
|
java.util.List<FieldReference> |
getUnresolvedParameters()
Get a list of unresolved field reference parameters for this join.
|
protected abstract boolean |
isServerJoin()
Report whether the join represented by this object takes place at the
database server, or within runtime code.
|
protected void |
raiseJoinError(RecordBuffer left,
RecordBuffer right,
boolean parentIsPersistent)
Throw
ErrorConditionException that signals that the specified tables cannot be joined. |
protected void |
setup(RecordBuffer local,
RecordBuffer inverse,
RelationInfo info,
boolean dereference)
Perform any additional setup necessary for a particular join helper
implementation.
|
public static final int NULL_FIELD
null fields.public static final int NOT_NULL_FIELD
not null fields.private final FQLExpression[][] fql
private final java.lang.Class<? extends DataModelObject> inverseIface
private final java.util.List<FqlType> parameterTypes
protected final BufferReference inverse
AbstractJoin(RecordBuffer local, RecordBuffer inverse)
local - Local record buffer (the referring end of the join).inverse - Inverse record buffer (the referent end of the join).public BufferReference getInverse()
public java.util.List<FieldReference> getUnresolvedParameters()
protected abstract boolean isServerJoin()
true if the join happens at the server;
false if it happens in the runtime.protected abstract FQLExpression[][] generateFQL(RecordBuffer local, RecordBuffer inverse, RelationInfo info, boolean dereference)
local - Local record buffer (the referring end of the join).inverse - Inverse record buffer (the referent end of the join).info - Relation descriptor object.dereference - true if the local DMO contains a reference to the foreign record, which must be
dereferenced in the FQL query; false if the local DMO is the foreign record,
referenced by the inverse DMO.null and the second
(NOT_NULL_FIELD) is used when the join field is not unknown.protected abstract java.util.List<FqlType> getParameterTypes(RelationInfo info, boolean dereference)
info - Relation descriptor object.dereference - true if the local DMO contains a reference to the foreign record, which
must be dereferenced in the FQL query; false if the local DMO is the
foreign record, referenced by the inverse DMO.null if no query substitution
parameters are used for this join.protected void setup(RecordBuffer local, RecordBuffer inverse, RelationInfo info, boolean dereference)
local - Local record buffer (the referring end of the join).inverse - Inverse record buffer (the referent end of the join).info - Relation descriptor object.dereference - true if the local DMO contains a reference to the
foreign record, which must be dereferenced in the FQL query;
false if the local DMO is the foreign
record, referenced by the inverse DMO.protected void raiseJoinError(RecordBuffer left, RecordBuffer right, boolean parentIsPersistent)
ErrorConditionException that signals that the specified tables cannot be joined.left - Record buffer which represents the left table in the join.right - Record buffer which represents the right table in the join.parentIsPersistent - Depending on this parameter, a specific error is raised: if true then error 230,
otherwise the pair 855 and 1832 are raised.ErrorConditionException - If parentIsPersistent then error 230, containing the text
'<Table1> of <Table2>'. Index fields of table 1 must be fields in table 2..
Otherwise, Unknown database name . and
** Workfile names cannot have database qualifiers. are raised.java.util.List<java.io.Serializable> getParameters()
null. Subclasses which need a
parameter must override this method.null.java.lang.Class<? extends DataModelObject> getInverseInterface()
FQLExpression[][] getFQL()
FQLPreprocessor and the join fields of the inverse may contain
unknown values, a bi-dimensional array of clauses are used. The first dimension is the size of the join
(aka the number of fields paired) and the second is always two: the first (0) is used when the joined
field is null and the second (1) is used when the join field is not unknown.
The enclosing query embeds these phrases into the overall FQL statement before executing the query based on the actual values of the inverse buffer.
null and the second
(NOT_NULL_FIELD) is used when the join field is not unknown.java.util.List<FqlType> getParameterTypes()
null
if no query substitution parameters are used for this join.