|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.websphere.objectgrid.config.QueryRelationship
public class QueryRelationship
A QueryRelationship represents a relationship between two BackingMap value classes. A BackingMap must have one class type defined in the value part of the map. A relationship can be established between two maps by mapping the source and target map's value classes.
The cardinality of the relationship is automatically determined by the type of the attribute field.
A relationship requires two classes, a relationship field, and optionally an inverse realtionship field.
For example: Two entities; Department and Employee, have the following bi-directional relationship:
public class Department { private int id; private Collection emps; public void setEmps(Collection emps) { this.emps = emps; } public Collection getEmps() { return emps; } ... } public class Employee { private int id; private Department dept; public void setDept(Department dept) { this.dept = dept; } public Department getDept() { return dept; } }Use the following method call to establish this bi-directional relationship.
queryConfig.addRelationship(new QueryRelationship( Department.class.getName(), Employee.class.getName(), "emps", "dept"));
Constructor Summary | |
---|---|
QueryRelationship(String sourceClass,
String targetClass,
String relationshipField,
String invRelationshipField)
Constructor for creating a QueryRelationship instance. |
Method Summary | |
---|---|
boolean |
equals(Object o)
|
String |
getInvRelationshipField()
Retrieve the inverse relationship attribute name of a bi-directional relationship. |
String |
getRelationshipField()
Retrieve the name of the attribute in the source class that references the key of the target class. |
String |
getSourceClass()
Retrieve the name of the class representing the source of a relationship. |
String |
getTargetClass()
Retrieve the name of the class representing the target of a relationship. |
int |
hashCode()
|
void |
setInvRelationshipField(String invRelationshipField)
Set the inverse relationship attribute name of a bi-directional relationship. |
void |
setRelationshipField(String relationshipField)
Set the name of the attribute in the source class that references the key of the target class. |
void |
setSourceClass(String sourceClass)
Set the name of the class representing the source of a relationship. |
void |
setTargetClass(String targetClass)
Set the name of the class representing the target of a relationship. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QueryRelationship(String sourceClass, String targetClass, String relationshipField, String invRelationshipField)
The sourceClass, targetClass, and relationshipField must not be null.
sourceClass
- the source class of the relationshiptargetClass
- the target class of the relationshiprelationshipField
- the attribute in the source class that references the key of the
target class.invRelationshipField
- the attribute in the target class that references the key of the
source class. This value is null if a bi-directional relationship does not exist.Method Detail |
---|
public String getInvRelationshipField()
public void setInvRelationshipField(String invRelationshipField)
invRelationshipField
- the attribute name of the inverse side of a bi-directional relationship or null if
the relationship is uni-directional.public String getRelationshipField()
public void setRelationshipField(String relationshipField)
relationshipField
- the name of the relationship attribute.public String getSourceClass()
public void setSourceClass(String sourceClass)
sourceClass
- the source classpublic String getTargetClass()
public void setTargetClass(String targetClass)
targetClass
- the target classpublic boolean equals(Object o)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |