Adempiere 3.5.2a

org.compiere.model
Class Query

java.lang.Object
  extended by org.compiere.model.Query

public class Query
extends Object

Author:
Low Heng Sin, Teo Sarca, SC ARHIPAC SERVICE SRL
  • FR [ 1981760 ] Improve Query class
  • BF [ 2030280 ] org.compiere.model.Query apply access fielter issue

  • Constructor Summary
    Query(MTable table, String whereClause, String trxName)
              Deprecated. Use Query(Properties, MTable, String, String) instead because this method is security error prone
    Query(Properties ctx, MTable table, String whereClause, String trxName)
               
    Query(Properties ctx, String tableName, String whereClause, String trxName)
               
     
    Method Summary
     int count()
              Count items that match query criteria
    <T extends PO>
    T
    first()
              Return first PO that match query criteria
    <T extends PO>
    Iterator<T>
    iterate()
              Return an Iterator implementation to fetch one PO at a time.
    <T extends PO>
    List<T>
    list()
              Return a list of all po that match the query criteria.
    <T extends PO>
    POResultSet<T>
    scroll()
              Return a simple wrapper over a jdbc resultset.
     Query setApplyAccessFilter(boolean flag)
              Turn on/off the addition of data access filter
     Query setOrderBy(String orderBy)
              Set order by clause ( without the order by sql keyword ).
     Query setParameters(Collection<Object> parameters)
              Set query parameters
     Query setParameters(Object[] parameters)
              Set query parameters
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    Query

    public Query(MTable table,
                 String whereClause,
                 String trxName)
    Deprecated. Use Query(Properties, MTable, String, String) instead because this method is security error prone

    Parameters:
    table -
    whereClause -
    trxName -

    Query

    public Query(Properties ctx,
                 MTable table,
                 String whereClause,
                 String trxName)
    Parameters:
    ctx - context
    table -
    whereClause -
    trxName -

    Query

    public Query(Properties ctx,
                 String tableName,
                 String whereClause,
                 String trxName)
    Parameters:
    ctx -
    tableName -
    whereClause -
    trxName -
    Method Detail

    setParameters

    public Query setParameters(Object[] parameters)
    Set query parameters

    Parameters:
    parameters -

    setParameters

    public Query setParameters(Collection<Object> parameters)
    Set query parameters

    Parameters:
    parameters - collection of parameters

    setOrderBy

    public Query setOrderBy(String orderBy)
    Set order by clause ( without the order by sql keyword ).

    Parameters:
    orderBy -

    setApplyAccessFilter

    public Query setApplyAccessFilter(boolean flag)
    Turn on/off the addition of data access filter

    Parameters:
    flag -

    list

    public <T extends PO> List<T> list()
                            throws DBException
    Return a list of all po that match the query criteria.

    Returns:
    List
    Throws:
    DBException

    first

    public <T extends PO> T first()
                       throws DBException
    Return first PO that match query criteria

    Returns:
    PO
    Throws:
    DBException

    count

    public int count()
              throws DBException
    Count items that match query criteria

    Returns:
    count
    Throws:
    DBException

    iterate

    public <T extends PO> Iterator<T> iterate()
                                   throws DBException
    Return an Iterator implementation to fetch one PO at a time. The implementation first retrieve all IDS that match the query criteria and issue sql query to fetch the PO when caller want to fetch the next PO. This minimize memory usage but it is slower than the list method.

    Returns:
    Iterator
    Throws:
    DBException

    scroll

    public <T extends PO> POResultSet<T> scroll()
                                     throws DBException
    Return a simple wrapper over a jdbc resultset. It is the caller responsibility to call the close method to release the underlying database resources.

    Returns:
    POResultSet
    Throws:
    DBException

    Adempiere 3.5.2a

    Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.