Class CollectionSizeMethod

java.lang.Object
org.datanucleus.store.rdbms.sql.method.CollectionSizeMethod
All Implemented Interfaces:
SQLMethod

public class CollectionSizeMethod extends Object implements SQLMethod
Method for evaluating {collExpr1}.size(). Returns a NumericExpression. Equates to a sub-query on the table for the collection returning the COUNT(*) of the number of elements. Something like
 SELECT COUNT(*) FROM COLLTABLE A0_SUB WHERE A0_SUB.OWNER_ID_OID = A0.OWNER_ID
 
where A0 is the candidate table in the outer query, and COLLTABLE is the join table (if using join collection) or the element table (if using FK collection).
  • Constructor Details

    • CollectionSizeMethod

      public CollectionSizeMethod()
  • Method Details

    • getExpression

      public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List<SQLExpression> args)
      Description copied from interface: SQLMethod
      Return the expression for this SQL function.
      Specified by:
      getExpression in interface SQLMethod
      Parameters:
      stmt - SQLStatement that this expression is for
      expr - The expression that it is invoked on
      args - Arguments passed in
      Returns:
      The SQL expression using the SQL function