Exemplo n.º 1
0
 /**
  * PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query. The query
  * will execute normally, however when any of the batched parts is accessed, the parts will all be
  * read in a single query, this allows all of the data required for the parts to be read in a
  * single query instead of (n) queries. This should be used when the application knows that it
  * requires the part for all of the objects being read. This can be used for one-to-one,
  * one-to-many, many-to-many and direct collection mappings.
  *
  * <p>The use of the expression allows for nested batch reading to be expressed.
  *
  * <p>Example: query.addBatchReadAttribute("phoneNumbers")
  *
  * @see #addBatchReadAttribute(Expression)
  * @see ObjectLevelReadQuery#addJoinedAttribute(String)
  */
 public void addBatchReadAttribute(String attributeName) {
   if (!getQueryMechanism().isExpressionQueryMechanism()) {
     throw QueryException.batchReadingNotSupported(this);
   }
   getBatchReadAttributeExpressions().add(getExpressionBuilder().get(attributeName));
 }
 /**
  * INTERNAL: Possible for future development, not currently supported.
  *
  * <p>Retrieve the value through using batch reading. This executes a single query to read the
  * target for all of the objects and stores the result of the batch query in the original query to
  * allow the other objects to share the results.
  */
 @Override
 protected Object batchedValueFromRow(AbstractRecord row, ReadAllQuery query) {
   throw QueryException.batchReadingNotSupported(this, query);
 }