org.jboss.ejb.plugins.cmp.jdbc
Class JDBCAbstractQueryCommand

java.lang.Object
  extended by org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand
All Implemented Interfaces:
JDBCQueryCommand
Direct Known Subclasses:
JDBCDeclaredSQLQuery, JDBCDynamicQLQuery, JDBCEJBQLQuery, JDBCFindAllQuery, JDBCFindByPrimaryKeyQuery, JDBCFindByQuery, JDBCJBossQLQuery

public abstract class JDBCAbstractQueryCommand
extends Object
implements JDBCQueryCommand

Abstract superclass of finder commands that return collections. Provides the handleResult() implementation that these all need.

Version:
$Revision: 57209 $
Author:
Dain Sundstrom, Rickard ´┐Żberg, Marc Fleury, Joe Shevland, Justin Forder, Alex Loubyansky

Nested Class Summary
static class JDBCAbstractQueryCommand.LeftJoinCMRNode
           
 
Field Summary
protected  org.jboss.logging.Logger log
           
 
Constructor Summary
JDBCAbstractQueryCommand(JDBCStoreManager manager, JDBCQueryMetaData q)
           
 
Method Summary
static void appendLeftJoinCMRColumnNames(List onFindCMRNodes, org.jboss.ejb.plugins.cmp.jdbc.AliasManager aliasManager, StringBuffer sb)
           
 Collection execute(Method finderMethod, Object[] args, EntityEnterpriseContext ctx, GenericEntityObjectFactory factory)
           
protected  Collection execute(String sql, Object[] args, int offset, int limit, JDBCEntityBridge selectEntity, JDBCCMPFieldBridge selectField, SelectFunction selectFunction, JDBCStoreManager selectManager, boolean[] eagerLoadMask, List parameters, List onFindCMRList, JDBCQueryMetaData queryMetaData, GenericEntityObjectFactory factory, org.jboss.logging.Logger log)
           
protected  String getEagerLoadGroup()
           
protected  boolean[] getEagerLoadMask()
           
static List getLeftJoinCMRNodes(JDBCEntityBridge entity, String path, Iterator leftJoinIter, Set declaredPaths)
           
protected  org.jboss.logging.Logger getLog()
           
protected  JDBCEntityBridge getSelectEntity()
           
protected  JDBCCMPFieldBridge getSelectField()
           
 JDBCStoreManager getSelectManager()
           
static void leftJoinCMRNodes(String alias, List onFindCMRNodes, org.jboss.ejb.plugins.cmp.jdbc.AliasManager aliasManager, StringBuffer sb)
           
protected  String parseParameters(String sql)
          Replaces the parameters in the specifiec sql with question marks, and initializes the parameter setting code.
protected  void setEagerLoadGroup(String eagerLoadGroup)
           
 void setLimitParam(int limitParam)
           
 void setLimitValue(int limitValue)
           
 void setOffsetParam(int offsetParam)
           
 void setOffsetValue(int offsetValue)
           
 void setOnFindCMRList(List onFindCMRList)
           
protected  void setParameterList(List p)
           
protected  void setSelectEntity(JDBCEntityBridge selectEntity)
           
protected  void setSelectField(JDBCCMPFieldBridge selectField)
           
protected  void setSelectFunction(SelectFunction func, JDBCStoreManager manager)
           
protected  void setSQL(String sql)
           
protected static int toInt(Object[] params, int paramNumber, int defaultValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.jboss.logging.Logger log
Constructor Detail

JDBCAbstractQueryCommand

public JDBCAbstractQueryCommand(JDBCStoreManager manager,
                                JDBCQueryMetaData q)
                         throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException
Method Detail

setOffsetValue

public void setOffsetValue(int offsetValue)

setLimitValue

public void setLimitValue(int limitValue)

setOffsetParam

public void setOffsetParam(int offsetParam)

setLimitParam

public void setLimitParam(int limitParam)

setOnFindCMRList

public void setOnFindCMRList(List onFindCMRList)

getSelectManager

public JDBCStoreManager getSelectManager()
Specified by:
getSelectManager in interface JDBCQueryCommand

execute

public Collection execute(Method finderMethod,
                          Object[] args,
                          EntityEnterpriseContext ctx,
                          GenericEntityObjectFactory factory)
                   throws javax.ejb.FinderException
Specified by:
execute in interface JDBCQueryCommand
Throws:
javax.ejb.FinderException

toInt

protected static int toInt(Object[] params,
                           int paramNumber,
                           int defaultValue)

execute

protected Collection execute(String sql,
                             Object[] args,
                             int offset,
                             int limit,
                             JDBCEntityBridge selectEntity,
                             JDBCCMPFieldBridge selectField,
                             SelectFunction selectFunction,
                             JDBCStoreManager selectManager,
                             boolean[] eagerLoadMask,
                             List parameters,
                             List onFindCMRList,
                             JDBCQueryMetaData queryMetaData,
                             GenericEntityObjectFactory factory,
                             org.jboss.logging.Logger log)
                      throws javax.ejb.FinderException
Throws:
javax.ejb.FinderException

getLog

protected org.jboss.logging.Logger getLog()

setSQL

protected void setSQL(String sql)

setParameterList

protected void setParameterList(List p)

getSelectEntity

protected JDBCEntityBridge getSelectEntity()

setSelectEntity

protected void setSelectEntity(JDBCEntityBridge selectEntity)
                        throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

getSelectField

protected JDBCCMPFieldBridge getSelectField()

setSelectField

protected void setSelectField(JDBCCMPFieldBridge selectField)

setSelectFunction

protected void setSelectFunction(SelectFunction func,
                                 JDBCStoreManager manager)

setEagerLoadGroup

protected void setEagerLoadGroup(String eagerLoadGroup)

getEagerLoadGroup

protected String getEagerLoadGroup()

getEagerLoadMask

protected boolean[] getEagerLoadMask()

parseParameters

protected String parseParameters(String sql)
                          throws org.jboss.deployment.DeploymentException
Replaces the parameters in the specifiec sql with question marks, and initializes the parameter setting code. Parameters are encoded in curly brackets use a zero based index.

Parameters:
sql - the sql statement that is parsed for parameters
Returns:
the original sql statement with the parameters replaced with a question mark
Throws:
org.jboss.deployment.DeploymentException - if a error occures while parsing the sql

getLeftJoinCMRNodes

public static List getLeftJoinCMRNodes(JDBCEntityBridge entity,
                                       String path,
                                       Iterator leftJoinIter,
                                       Set declaredPaths)
                                throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

leftJoinCMRNodes

public static final void leftJoinCMRNodes(String alias,
                                          List onFindCMRNodes,
                                          org.jboss.ejb.plugins.cmp.jdbc.AliasManager aliasManager,
                                          StringBuffer sb)

appendLeftJoinCMRColumnNames

public static final void appendLeftJoinCMRColumnNames(List onFindCMRNodes,
                                                      org.jboss.ejb.plugins.cmp.jdbc.AliasManager aliasManager,
                                                      StringBuffer sb)


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.