Class RelationshipQuery

  • All Implemented Interfaces:
    Serializable, Query

    public class RelationshipQuery
    extends IndirectQuery
    A query that selects objects related to a given object via a mapped relationship. RelationshipQuery is used by Cayenne internally to resolve relationships, and is rarely executed by the application directly, although this of course is possible too.
    Since:
    1.2
    See Also:
    Serialized Form
    • Field Detail

      • relationshipName

        protected String relationshipName
      • refreshing

        protected boolean refreshing
      • statementFetchSize

        protected int statementFetchSize
      • metadataResolver

        protected transient EntityResolver metadataResolver
    • Constructor Detail

      • RelationshipQuery

        public RelationshipQuery​(ObjectId objectID,
                                 String relationshipName)
        Creates a RelationshipQuery. Same as new RelationshipQuery(objectID, relationshipName, true).
        Parameters:
        objectID - ObjectId of a root object of the relationship.
        relationshipName - The name of the relationship.
      • RelationshipQuery

        public RelationshipQuery​(ObjectId objectID,
                                 String relationshipName,
                                 boolean refreshing)
        Creates a RelationshipQuery.
        Parameters:
        objectID - ObjectId of a root object of the relationship.
        relationshipName - The name of the relationship.
        refreshing - whether objects should be refreshed
    • Method Detail

      • getObjectId

        public ObjectId getObjectId()
      • isRefreshing

        public boolean isRefreshing()
      • getRelationshipName

        public String getRelationshipName()
      • setStatementFetchSize

        public void setStatementFetchSize​(int size)
        Sets statement's fetch size (0 for no default size)
        Since:
        3.0
      • getStatementFetchSize

        public int getStatementFetchSize()
        Returns:
        statement's fetch size
        Since:
        3.0
      • toString

        public String toString()
        Overrides toString() outputting a short string with query class and relationship name.
        Overrides:
        toString in class Object